forked fromglynos/cpp-netlib
- Notifications
You must be signed in to change notification settings - Fork425
Open
Description
Use case: I want to let the OS choose the port by supplying port 0 during initialization. This allows multiple applications to run concurrently, and the actual port will be communicated e.g. through zeroconf to the user.
I need to know the port chosen from the application, e.g., by having an API on the server to query the used address and port.
For example, inhttps://github.com/HBPVIS/ZeroEQ/blob/0.6.0/tests/http/server.cpp#L244 the URI has port 0 by default, and the URI returned after initialization in line 255 will contain the chosen port so that the client can connect to the server.
API proposal:
class Server{ std::string port() const; // >0 after listen, 0 otherwise std::string address() const;};
Metadata
Metadata
Assignees
Labels
No labels