Simcoder Posted July 5, 2005 Posted July 5, 2005 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=- Quote Whatever thy hand findest to do, do it with all thy heart - Jesus
Diesel Posted July 6, 2005 Posted July 6, 2005 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 Quote
Simcoder Posted July 6, 2005 Author Posted July 6, 2005 Thanks Diesel, I'll try it out and let you know what happens. -=Simcoder=- Quote Whatever thy hand findest to do, do it with all thy heart - Jesus
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.