Multiple sockets listening on same port

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Multiple sockets listening on same port

Attila Magyar
Hi,

A number of times I ran into the situation where I started a http server but forgot that an other one was already running. This resulted strange behavior and led to confusion.

The Socket class doesn't detect that the given port is already bound to an other socket.

        socket1 := Socket newTCP.
        socket1 listenOn: 9999.

        socket2 := Socket newTCP.
        socket2 listenOn: 9999.         "I expected this to fail"

Both sockets are in WaitinForConnection status and isValid returns true.

Is this normal? Is there a way to detect this anyway?