I have a recv function inside of a thread so that i can constantly receive messages and still be able to control my GUI.
The receiving part however isn't really working the way i was hoping. Cause at a point the strings that i receive are broken appart.
So like if im expecting the string: hello_world, i get ("hel", llo", "_worl", "d") chopped up in sepperate strings.
Now my idea is to receive the messages and wait untill it encounters the newline \r\n which indicates the end of a string. When it doesn't see a newline (\r\n) yet it should paste the received string to the other strings it received before so that i still end up with the correct string.
I hope i explained it good enough of about what im trying to do, if not then please say so and ill try it again.
Would something like this work? (pseudo code)
while(recv(socket, buffer, strlen(buffer), 0))
completeBuffer += buffer;