Strange socket behavior..?

I’m going to try to keep this short while still providing enough information.

I’m creating an application utilizing sockets, one of the features is basic chat. I realized that for some strange reason certain strings were producing strange results.

For example if I entered ‘Something weird’, only ‘S’ would appear. So did some debugging and got some strange results. I traced out socket.bytesAvailable just before reading from the socket and would get a certain number. Then after reading everything from the socket, when checking the length of the string read from it, I would get a different number?

How is this possible? Anyone have any ideas?