TCP/IP packet run-together-ing
I don't know exactly where to put this... So I'll play it safe and put it here. It's more networking related than C or C++.
I'm writing a chat program for Flashdaddee. It uses TCP/IP to connect and send packets both ways. Every packet must be at most 500 bytes.
My problem is that there are some places where packets run together. My send command sends the exact length of bytes needed, and my receive command receives up to 500 bytes, maximum.
Most of the time, one packet is received as a whole, and the client program processes it like normal. But when I send one packet after another, with 2 seperate send commands, they are both received as one packet. The one sent second can be seen right after the first one.
Can anyone here explain why this happens? Would it be practical to wait for acknowledgement from the receiving side each time a packet is sent? Is there another, simpler way I haven't thought of?