G
Guest
I got the following error when revieving data from a server.
hostSystem.Net.Sockets.SocketException: An existing connection was forcibly
closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[]
buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
This error only happens when the long time recieving data, in this case 50
seconds. It looks to me like a time out error.
I have an j++ application which does the same thing but can revieve data
without any problem.
Code:
createSockConnection();
sock.Blocking = true;
sock.NoDelay = true;
sock.ReceiveTimeout = 10000000;
byte[] readBytes = new byte[1024];
Int32 sizeReceived = 0;
WebHeaderCollection Headers = new WebHeaderCollection();
while ((sizeReceived = sock.Receive(readBytes, readBytes.Length,
SocketFlags.None)) > 0)
{
nTotalBytes += sizeReceived;
ResponseText.Write(readBytes, 0, sizeReceived);
}
Please help.
thanks
Kevin Yang
hostSystem.Net.Sockets.SocketException: An existing connection was forcibly
closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[]
buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
This error only happens when the long time recieving data, in this case 50
seconds. It looks to me like a time out error.
I have an j++ application which does the same thing but can revieve data
without any problem.
Code:
createSockConnection();
sock.Blocking = true;
sock.NoDelay = true;
sock.ReceiveTimeout = 10000000;
byte[] readBytes = new byte[1024];
Int32 sizeReceived = 0;
WebHeaderCollection Headers = new WebHeaderCollection();
while ((sizeReceived = sock.Receive(readBytes, readBytes.Length,
SocketFlags.None)) > 0)
{
nTotalBytes += sizeReceived;
ResponseText.Write(readBytes, 0, sizeReceived);
}
Please help.
thanks
Kevin Yang