Hi
Ii have a simple server thread in an app that listens for connections, for
some unclear reason an exception is thrown
every now and then : 'A blocking operation was interrupted by a call to
WSACancelBlocki ngCall '
Any suggestion why this may happen ?
The Exception is thrown by the svr.AcceptTcpCl ient() method
See source below.
Any Idea's ?
private void serverthrd()
{
IPAddress localAddr = IPAddress.Any;
svr = new TcpListener(loc alAddr, 2028);
TcpClient client=null;
svr.Start();
while(true)
{
try
{
// Enter the listening loop.
// Perform a blocking call to accept requests.
// You could also user server.AcceptSo cket() here.
client=null;
Console.WriteLi ne("Listen for clients...");
client = svr.AcceptTcpCl ient();
client.NoDelay= true;
client.ReceiveT imeout = 10000;
client.SendTime out = 10000;
// Get a stream object for reading and writing
NetworkStream stream = client.GetStrea m();
// do something
// and then close
stream.Close();
client.Close();
}
catch(SocketExc eption ee)
{
Console.WriteLi ne("SocketExcep tion: {0}", ee);
}
}
}