4 ms·
> Our mistake was the server was running on an ephemeral port. Typical idioms have the server as a connection responder and not an initiator. When the server
by wyldfire 10y ago
> Our mistake was the server was running on an ephemeral port.
Typical idioms have the server as a connection responder and not an initiator. When the server is a responder it's typically on a well-known port for the sake of the clients knowing where to find it. Having a server on an ephemeral port sounds like a pretty uncommon use case.
- to3m 10y agoOne way you can have a listening port in the ephemeral range is to specify 0 as the port when binding, allowing the system to assign the port for you. You might do this if you're using the socket for some kind of parent<->child IPC. (Pipes might be more usual for this sort of thing, but sockets code is a bit easier to make portable between Windows and POSIX, and you also get the option of running both sides on different systems.)