[SDL] SDL_net Socket listeners not unique?

Jon Daniel forcemaster at gmx.net
Thu Sep 22 02:50:51 PDT 2005

On Mon, 19 Sep 2005 00:58:36 +0200
Colin Vella <colinvella at waldonet.net.mt> wrote:

> The trouble with this is that, unlike other TCP socket APIs, opening
> up  a listening socket on some port, say 80, does not acquire
> exclusive  access to the port. In other words, I can run multiple
> instances of a  server application listening on the same port using
> this code, and they  will not conflict. Even more oddly, client
> connections occur on any of  the running servers in a seemingly ad-hoc
> basis! What's going on here?  Should't SDLNet_ResolveHost /
> SDLNet_TCP_Open fail if the port is  already taken?
This is not a bug SDL_net. You should read about the socket option
SO_REUSEADDR which SDL_net uses of course for server sockets.

Also it might introduce a security risk for operating systems that allow
multiple bindings of reserved ports without superuser privileges.
I don't know if that is the case for win32.

Jon Daniel

More information about the SDL mailing list