Implement socket data-to-packet logic