Wait for greetings data to arrive

Previously, if greetings data was not immediately readable from the
opened socket, the connection failed because only partial greetings were
received.
Merge pull request #5 from anttihirvonen/connection-greetings-fix

Problems with TCP packets
editor: wait for data in a loop

The first packet of data might not be sufficient for our needs,
so make sure we wait until enough data has arrived. If an error
occurs, break out and let the reading code-do the clean-up.