If using a SocketSelector, you should keep accepting data from the socket until has_data returns false, indicating that you've read everything.
If using a SocketSelector, you should keep accepting data from the socket until has_data returns false, indicating that you've read everything.