Problems With TcpClient

Simcoder

Centurion
Joined
Apr 18, 2003
Messages
125
Location
South Carolina
Recently, I've started looking into sockets and tcp. I ended up downloading the server/client chat example that Microsoft offers in the 101 Examples package and been doing some modifications to it. I've come across a problem
that has me stumped. I have a method that sends information to a client and inside that method is another method that sends data elsewhere. The problem is that the messages are not always being sent separately, sometimes the information is being concatanated and then sent. When I put a break point in my code and then slowly step through, everything works fine, but during regular execution, I guess it sends data so fast that it just concatanates it or something. If anyone could shed some light on this, it would be much appreciated. Thanks in advance.

-=Simcoder=-
 
From what you said, I'm guessing you are using asynchronous data transfer and the server is sending data while the client is processing other data, so the data being sent gets cached before the client open the socket for input

One way to fix this is a handshake, send a piece of data synchronously and then send an acknowledgement back

Then you should be able to send the async data
 
Back
Top