Socket.BeginReceive problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I use socket in my program and I have a problem on BeginRecieve.
The code is like this:

connection.Socket.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None,
new AsyncCallback(RecieveData), connection);

I test the code with telnet on win32, netcat on freebsd, both works fine.
But when I connect with netcat for win32 downloaded from
http://www.vulnwatch.org/netcat/ there's a problem.

If I connect to the server, then, after the BeginReceive is called, press
Ctrl-C to end connection from client side, the server will crash.

Is this the bug of Socket class?
 
Cecil Sheng said:
[...]
If I connect to the server, then, after the BeginReceive is called, press
Ctrl-C to end connection from client side, the server will crash.

Is this the bug of Socket class?

If you, on the client side, can do *anything* that causes the server to
crash, then that's a bug in the server.

There may also be a bug on your side (though I doubt it will be found in the
Socket class), but nothing you can do from the client side should ever crash
the server.

Pete
 
The problem is very easy to reproduce. You only need the nc.exe from the
website and BeginRecieve. But still i don't know how to fix it, because the
server code crashes in System.dll when the client disconnects.
Cecil Sheng said:
[...]
If I connect to the server, then, after the BeginReceive is called, press
Ctrl-C to end connection from client side, the server will crash.

Is this the bug of Socket class?
 
Back
Top