Hi,
Thanks for the info. I know about interporating with the API using PInvoke.
But what I was asking for was a .NET way of acheiving the same
functionality. This limitation is not important enough for me to build whole
wrapper classes for the winsock API.
Also, I do catch the exceptions and they do contain the information about
the socket being closed. However, what I need is some way to determine if
the socket has been closed without traffic to the server. Consider that the
client connects to the server and everything is good. Sits there idle for
awhile, then the server is shutdown. Now the client will sit there for an
indefinite period of time (until it tries to talk again) before it knows the
server is gone.
Our C++ apps which use the Win32 API are notified immediately when the
server is shutdown. I was asking if there is the same functionality in the
..NET sockets. I guess the answer is no.
Thanks again,
Michael
"Tian Min Huang" <ti******@online.microsoft.com> wrote in message
news:Ko**************@cpmsftngxa06.phx.gbl...
Hello Michael,
Thanks for your reply. I'd like to share the following information with
you:
1. According to the SocketException, it's clearly indicate that the
connection was closed by the server.
"System.Net.Sockets.SocketException: An existing connection was forcibly
closed by the remote host"
2. You can also call winsock APIs directly by using Platform Invoke.
Please refer to the following MSDN article:
Consuming Unmanaged DLL Functions
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconconsumingunmanageddllfunctions.asp
Hope this helps.
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no
rights.