Timeout error

Himo

Well-known member
Joined
Dec 22, 2004
Messages
61
Location
the Netherlands
Hi,

Im using WinSock in C# to send some data to a server(duh). The problem is that I have a loop that does some things other then sending data. After some time, about 10-15 times sending, I get this error:

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

How can I work around this? I know that it probably has something to do with timeouts, but where can I change those settings?
 
[CS]
for(int i = 0; i <= 31; i++ )
{

for(int idx=0;idx<16;idx++)
{
for(int idx2=0;idx2<=i;idx2++)
{
cookie = //some datatests

buffer = "HEAD /PATH HTTP/1.1\r\n"; //
buffer += "Host: SERVER\r\n";
buffer += "Cookie: " + cookie + "\r\n";
buffer += "Connection: close\r\n";
buffer += "\r\n";

buffer2 = Encoding.ASCII.GetBytes(buffer);
s.Send(buffer2,buffer2.Length,0);
//Error above @ s.Send() <--

int counter = 1;
while (counter > 0)
{
counter = s.Receive(bytes, bytes.Length, 0);
header = header + Encoding.ASCII.GetString(bytes, 0, counter);
}


if(header.IndexOf("LOCATION\r\n",0,header.Length) == -1)
{
//Do Stuff
}

}
}

//Reset stuff
}
[/CS]
 
Out of interest what makes you suspect a timeout is causing the problem?
What is running on the remote service (Im guessing it is a webserver) and are you sure you are sending the correctly formatted requests to it?
If you output your requests to a debugger do the ones that break the app still appear to be correct and valid?
 
Back
Top