Can a socket be reused after calling Shutdown?

A

Alain Dekker

In circumstances where the Socket.Disconnect method is not available (.NET
1.1 or the Compact Framework 2.0), is it possible to re-used the socket
after calling Shutdown?

If not, is there a PInvoke that can be used to call a lower-level API to
achieve reuse?

My application requires a connection to be made, data sent and then the
connection terminated. The target application is legacy (and cannot be
changed) and simple listens on a single port number for incoming
connections.

Thanks,
Alain
 
A

Alain Dekker

The current code calls Shutdown on the socket, then closes it. The next time
a message must be resent, the socket is re-created. I can continue to use
that method. You're right on the larger issue that if the .NET version
doesn't support some features it might be time to move onto a more recent
version. But as anyone who works on a limited time and fiscal budget will
know, upgrading is risky and costly.

Thanks,
Alain
 

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