A blocking operation was interrupted by a call to WSACancelBlockingCall -- can async I/O solve this

R

Ryan Liu

Hi,

I have a 100 clients/ one server application, use ugly one thread pre client
approach. And both side user sync I/O.

I frequently see the error on server side(client side code is same, but I
don't see the error):

"System.IO.IOException: Unable to read data from the transport connection:A
blocking operation was interrupted by a call to WSACancelBlockingCall"

This error msg is seen when sever thread endless read from network stream.

What does this mean? Can I solve this problem by using async I/O on server
side?
Does client using which type I/O affect server side?

When server thread writes to the network steam, there are also error
soemtime: "System.InvalidOperationException: The operation is not allowed on
non-connected sockets. "
How can I avoid sockets getting disconnected? Is this also due to
"interrupted by a call to WSACancelBlockingCall" error when read from
socket?

-------
One time I used async I/O on sever side and sync I/O on client side, then
the server shuted itself down automatically, later I found there are Trojan
Horse virus in the network. I don't know the server crashs due to my new
code or because of virus . I don't always have the chance to try out my new
code.

That time I also see async new read error on server side when
NetworkStream.EndRead(), but seems it is more reasonable, and I just ignore
and BeginRead again:

" System.IO.IOException: Unable to read data from the transport connection:
A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond. --->
System.Net.Sockets.SocketException: A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)

and sometime evern worse error for EndRead():

"System.IO.IOException: Unable to read data from the transport connection:
An existing connection was forcibly closed by the remote host. --->
System.Net.Sockets.SocketException: An existing connection was forcibly
closed by the remote host" -- Is that true? But I didn't write any code on
client side to close the connection until logout.

What all these mean? What makes it so fragile? Where to get started to learn
write more
roburst network program?

Thanks!
Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top