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
WSACancelBlockingCall '
Any suggestion why this may happen ?
The Exception is thrown by the svr.AcceptTcpClient() method
See source below.
Any Idea's ?
private void serverthrd()
{
IPAddress localAddr = IPAddress.Any;
svr = new TcpListener(localAddr, 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.AcceptSocket() here.
client=null;
Console.WriteLine("Listen for clients...");
client = svr.AcceptTcpClient();
client.NoDelay=true;
client.ReceiveTimeout = 10000;
client.SendTimeout = 10000;
// Get a stream object for reading and writing
NetworkStream stream = client.GetStream();
// do something
// and then close
stream.Close();
client.Close();
}
catch(SocketException ee)
{
Console.WriteLine("SocketException: {0}", ee);
}
}
}