I'm currently working on a project where we need to implement a protocol on top of TCP, we're attempting to use the streams API and we have success connecting to a server and sending messages over the socket. What's causing trouble though is receiving messages back, since we don't know ahead of time the size of the response we're calling read() with no arguments and we'll get the first response just fine, but the next response will be chopped up.
For example: We send a message like 8=FIX.4.3\x019=63\x0135=5\x0149=DEMO.ZION2_P.FIX\x0156=ABFX\x0134=4\x0152=20150730-18:42:07.013\x0110=130\x01 to the server, and it responds with something similar in format with no trouble. However, when we send a second message, the response will be chopped into just the "8" and then after we send a third message the other chunk of the second response will come through like =FIX.4.3\x019=63\x0135=5\x0149=DEMO.ZION2_P.FIX\x0156=ABFX\x0134=4\x0152=20150730-18:42:07.013\x0110=130\x01 I can add some code examples if needed but I think I just need help with understanding how to read() continuously since the documentation examples are just reading single lines or to the EOF.
