// JP opened flex table

Click to See Complete Forum and Search --> : winsock send function not working


beecheyp
March 15th, 2004, 01:55 PM
Hi All,
I have a mutilthreaded socket based application built using C++ .Net (unmanaged) running on windows 2000 SP3. Basically over the last couple of weeks I have discovered that the send function (that writes a message to a socket) is returning correctly, yet the message is not being sent anywhere.

Today we used a packet sniffer to actually look at whats going on in the servers TCP/IP stack and the message reportedly being sent correctly appears no where!

How is possible for this to happen? has anyone else had to deal with this? My socket class has not been changed in ages yet this has just started happening.

Any help/ideas would be greatly appreciated as this is a production system!

Many thanks in advance,

Paul.

Mathew Joy
March 15th, 2004, 11:42 PM
are you using basic blocking send() api? How many bytes are you sending? Do you monitor on the client side? MS NetMon is a good network monitor. If the connection is not terminated, your client side tcp/ip stack should recv the bytes send by the server, properly and in order. BTW the no of bytes returned by send() doesn't mean that the data is on wire. It only means that the said amount is handed down to tcp/ip for processing.

beecheyp
March 16th, 2004, 03:55 PM
Ok, found a little more out. The case of the disappearing message was indeed caused by a rubbish implementation of a send function however this was an isolated case and not the real problem.

As it happens we now use a freeware program called ethereal to look at the TCP/IP stack on the server where my code runs. I am the client sending messages to a server of TCP/IP via a BT IPClear network.
Basically on examining what is going on within the TCP/IP stack we see that every now and again we execute a tcp retransmission for apparently no reason. From what I can see the original TCP send to the server goes AWOL (thought TCP/IP guards against this) and then because of this we re-transmit the message. The server then gets this but responds with a TCP out of order message. As I do not know the internals of TCP can someone explain why we get the out of order message back and why TCP/IP does not end up sorting itself out?

Any ideas/thoughts would be appreciated.

Mathew Joy
March 17th, 2004, 12:15 AM
Originally posted by beecheyp
...why TCP/IP does not end up sorting itself out?The answer is...As I do not know the internals of TCP You are analysing the stack without knowing what the heck it does. Search in google for tcpip2000.doc. Maybe that will be a starter.

The answer to your question is, tcp stack on the client side will not give you a byte x, if it hasn't given you all of the bytes from 1 to x-1 considering server sending bytes 1,2,3..x-2,x-1,x,x+1... in the same order.

//JP added flex table