ServerSocket.StopListening doesn't stop listening

ServerSocket.StopListening does not actually stop listening. It won’t hand an incoming connection off to a socket you created in AddSockets, but it’s still listening, and incoming connections think they connected. I am on windows 8. Do anyone have a solution. There is already a feedback report submitted.

Anyone from Xojo have a solution for this

StopLiestening does not disconnect existing sockets. It only stops the server from issuing new sockets to new connections. Is this what’s broken for you?

Or are you expecting that it will unbind from the network interface & port when you stop listening ?

I expect to unbind the port. Because now as long as the app is running the port is listening and cannot be used by itself or any other app.

Hi Norman / Greg,
Will this unbinding of port be considered in the coming versions of xojo. For reusing the port i need to exit the app now. Or atleast is there any declares that i can use for unbinding the port. I am on windows.

Standard practice for us is not to discuss future versions and what things may / may not be in them.
I’ve brought this question to the engineer who can assess the issue better.
At this point that’s about all I can say.

I’m not aware of a means to unbind the socket from the port it is listening on.

Just a thought, call stop listening on the server socket and then create a method to connect to the remaining listeners and then disconnect.

For the ones that are active I believe you can cycle through the active connections and disconnect those.

From what I see with the ServerSocket example, if I close the window where there is an instance of MainServerSocket, the client receives an error 102 and does not seem to have a server listening any more. Which makes sense, since the socket was destroyed with the window.

Does not the destruction of the socket also release the port ?

Thanks Norman for the kind information that the issue has been taken up.

@Rich Hatfield, for testing no need of any active connections. Just listen to any port and call stop listening. Then without quitting the app you cannot bind to that port by the same app or different app. If you try to telnet that port it accepts that connection. But the actual dosent respond to that incoming connection. So you are kind of lost.