Hi,

I wanted to know how can we close or shutdown the socket. I have built a chat program using asynchronous sockets and now I want to change the port at run time. But, when I try to close the port it is already listening to I get exceptions like only "only one usage of each socket address protocol network address port is normally permitted sockets" or "the iasyncresult object was not returned from the corresponding asynchronous method on this class." I am new to this stuff and don't know how to fix it. I read lot of stuff but nothing helped. can anyone suggest what to do?
I am trying to close the previous port it was listening on and start listening on new port. I also tried shutdown socket before closing it. I am very confused. Please help..

Thanks!

Usually you want to close and dispose a socket or listener and create a new instance. In some cases sockets cannot be reused. Can you post the relevant code where you are having these issues?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.