C
Chan
Building an Asyc Socket DLL using C#, I followed MS .NET FRAMEWORK
library sample (see "Asynchronous Client Socket Example") and created
a DLL called MSSock. I then reference MSSock in a .exe c# program to
test it.
This .exe has a form which has a button and a text field to invoke the
DLL async communication and display return data.
<F5>, runs ok and data returned is being displayed. Without exiting
the app, click on the button again, this supposed do exactly connect,
send, receive, close and displaying data. But, the following comes up
in a dialog box,
----------------------------------------------------------------------------
An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in netsock.dll
Additional information: A request to send or receive data was
disallowed because the socket is not connected and (when sending on a
datagram socket using a sendto call) no address was supplied
----------------------------------------------------------------------------
Ok, I set a breakpoint at the line the DLL is called, stepping through
all of the lines, it ran perfectly fine, no error, returns data as
expected.
It's repeated many times with machine rebooting. I opened up a DOS
window, use
netstat -p TCP
to check socket connection statistics, whenever I got the above error,
netstat showed the State as ESTABLISHED.
library sample (see "Asynchronous Client Socket Example") and created
a DLL called MSSock. I then reference MSSock in a .exe c# program to
test it.
This .exe has a form which has a button and a text field to invoke the
DLL async communication and display return data.
<F5>, runs ok and data returned is being displayed. Without exiting
the app, click on the button again, this supposed do exactly connect,
send, receive, close and displaying data. But, the following comes up
in a dialog box,
----------------------------------------------------------------------------
An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in netsock.dll
Additional information: A request to send or receive data was
disallowed because the socket is not connected and (when sending on a
datagram socket using a sendto call) no address was supplied
----------------------------------------------------------------------------
Ok, I set a breakpoint at the line the DLL is called, stepping through
all of the lines, it ran perfectly fine, no error, returns data as
expected.
It's repeated many times with machine rebooting. I opened up a DOS
window, use
netstat -p TCP
to check socket connection statistics, whenever I got the above error,
netstat showed the State as ESTABLISHED.