August 27th, 2011, 02:07 PM
[RESOLVED] TCPClient sockets
I am not sure if theis is the correct place to ask this question, so if I am wrong then please just inform me where it should be placed.
I am opening a socket connection to a server, send a message, receiving a reply and close the socket all this goes very well so far. But when I close the socket the last message I sent gets sent again, which confuses me. Why would a TCPClient.Close() send the data again. Could someone explain to me why this might happen and how I should close the socket so that it does not send the message again.
August 27th, 2011, 05:31 PM
Re: TCPClient sockets
Normally the message would not get sent again. However, it is very difficult for us to tell what might be happening without seeing your code. Could you post some of the code where you think the problem might be.
don't forget to use Code tags
August 28th, 2011, 07:21 AM
Re: TCPClient sockets
That's not how TCP sockets work. Every byte is sent at the most once. If messages are arriving twice it's because you're sending them twice. Are you 100% sure you're not sending the same messages twice?
For all your .NET bittorrent needs
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.
August 29th, 2011, 07:38 AM
Re: [RESOLVED] TCPClient sockets
After testing this problem many times I determined that the socket cannot be sending the message when I close the socket. Still I was seeing the message posted on the server again after the close. So I wrote up a second app in c++ to see what was going on. Well sure enough the same thing was happening. So I have determined that it is the server that is causing this apparent send after the close. Unfortunately I did not create this server module so I cannot check it to see why it is doing it, so I will live with this wierd action.
Thank you all for responding to my question, I appreciate it very much.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!