socket.close()

R

Ronny

I need to close a socket and use it immedeiatly again with another local
port. Is it enough to do socket.close() in order to release all resources,
or must I do anything more(like a delete or similar) before I use the "new"
operator?
Regards
Ronny
 
P

Peter Duniho

Ronny said:
I need to close a socket and use it immedeiatly again with another local
port.

You can't.
Is it enough to do socket.close() in order to release all resources,

Yes, Close() is equivalent to Dispose(). But after you close the
socket, it can't be reused. You have to create a new instance.

If the socket is a connection-oriented socket (e.g. TCP), also make sure
you do a graceful shutdown when possible (i.e. there haven't been any
errors on the socket).

Pete
 

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