Login  Register

Multiple sockets listening on same port

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

Multiple sockets listening on same port

Attila Magyar
99 posts
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?