Socket connection aborted by host

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a Socket object in syncronous mode in VS2005 C# using .NET
framework 2.0. The socket is receiving data from a remote device which does
not support a full-fledged TCP/IP stack, but the basic functionality is
implemented in the firmware. Ocassionally, if there is a large amount of data
being transferred from the device, I get the following error in my loop which
is executing the Socket.Receive(inputByteBuffer) method...

"An established connection was aborted by the software in your host machine".

This error implies that it is my machine that is terminating the TCP/IP
connection. Is that the case, or is it possible that the remote device is
terminating is actually doing so. I am also using the following code to turn
KeepAlives on and set the receiveTimeOut for the socket at large enough
values, however, these do not seem to have any effect.

m_clientSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.KeepAlive, true);
m_clientSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, 300000);
m_clientSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, 300000);

byte [] keepAliveStruct = new byte[] {0x01, 0x00, 0x00, 0x00,
0x30, 0x75, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00};
byte [] outValue = BitConverter.GetBytes(0);
m_clientSocket.IOControl(IOControlCode.KeepAliveValues,
keepAliveStruct, outValue);


Is it possible that the remote device is not respecting the KeepAlive
requests from my host? How can I ensure that it is not my side that is
terminating the connection? Thanks.

Harv Hundal
 
Hello, Harv!

HH> Is it possible that the remote device is not respecting the KeepAlive
HH> requests from my host? How can I ensure that it is not my side that is
HH> terminating the connection? Thanks.

Use a sniffer ( e.g. Ethereal, Network Monitor or other ) to see what happens
on the wire. Watch for FIN tcp packet...

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Back
Top