Socket Programming Question?

client.read() only reads in a single character at a time. It's your responsibility to read in all available characters into an appropriately sized array to contain them prior to processing/parsing.

fyi, string is NOT an appropriate container to use.