Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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=-

Whatever thy hand findest to do, do it with all thy heart - Jesus
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...