Hey, i have an Async nonblocking client/server application which should send strings to each other. Only the problem is that the string comes in in parts.
So i send the following string with the client to the server:
Hello
Then the server recieves it like this:
H
e
l
l
o
But it is important that i can send a complete strings to the server. Anyone any idea why this isn't happening now??
How large is the byte buffer that your placing the received string into? If its only one byte, you will receive only one byte off of the internal buffer at a time.
EDIT:
Also, I cant help but notice your sending ASCII bytes, but receiving and decoding them into UTF-8. It should work regardless but just for consistency sake have you thought about receiving them and decoding them as ASCII?
R.I.P. 3.5" Floppy Drives
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
But it is important that i can send a complete strings to the server. Anyone any idea why this isn't happening now??
Generally, this is impossible due to how TCP operates. If you send 100 bytes, they can arrive in a single 100 byte chunk or one hundred 1 byte chunks. Your application has to cope with that.
NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
Bookmarks