Home All Groups Group Topic Archive Search About

Socket.BeginReceive problem

Author
2 Nov 2006 7:02 AM
Cecil Sheng
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?

Author
2 Nov 2006 7:32 AM
Peter Duniho
"Cecil Sheng" <cecilsh***@foquest.com.tw.(donotspam).com> wrote in message
news:55B89FF0-2C8B-4400-9A76-D6251807D49D@microsoft.com...
> [...]
> 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
Author
6 Nov 2006 8:11 AM
Cecil Sheng
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.

Show quote
> "Cecil Sheng" <cecilsh***@foquest.com.tw.(donotspam).com> wrote in message
> news:55B89FF0-2C8B-4400-9A76-D6251807D49D@microsoft.com...
> > [...]
> > 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?

AddThis Social Bookmark Button