in reply to same port

Did you try it? I think you'll get an error that the port is already in use. This makes sense, because what do you think would happen with two servers listening on the same port? Which one should get the packets sent to that port? Should they fight it out with a game of Rock Paper Scissors to decide?

Replies are listed 'Best First'.
Re^2: same port
by Fletch (Bishop) on Jul 09, 2004 at 00:34 UTC

    Actually not germane to the original question, but you can have multiple processes listening on the same port. Perhaps the most familiar instance of this would be apache where each of the child httpds can have a copy of the same socket descriptor (and use a locking mechanism on some OSen (older Solaris in particular) where multiple processes calling accept isn't handled correctly). Hypothetically you could have intelligence enough in each server process to determine what protocol was being spoken and do a file descriptor send (aka deep POSIX IPC wizardry) to another process if the one that received the connection can't handle it, but I can't think of any practical benefit to doing so.