You should be able to bind to any IPv4 or IPv6 interface available on your system. To see what addresses are available, enter the shell command `ip a`.
Choose the IP address of the interface that is assigned to the physical connection device you want your websockets server to listen on.
Typically, a websocketpp will implement a server with a member named `m_server`. When the server's `run` method, you should see a call like this:
m_server.listen(port);
This results in a call to `void websocketpp::transport::asio::endpoint<config>::listen(uint16_t port)`
There is another overload available which takes two strings:
void listen(std::string const & host, std::string const & service, lib::error_code & ec)
The documentation for this overload is:
/// Set up endpoint for listening on a host and service (exception free)
/**
* Bind the internal acceptor using the given host and service. More details
* about what host and service can be are available in the Asio
* documentation for ip::basic_resolver_query::basic_resolver_query's
* constructors.
*
* The endpoint must have been initialized by calling init_asio before
* listening.
*
* @param host A string identifying a location. May be a descriptive name or
* a numeric address string.
* @param service A string identifying the requested service. This may be a
* descriptive name or a numeric string corresponding to a port number.
* @param ec Set to indicate what error occurred, if any.
*/
So, suppose you want to listen on your Wifi device. You determine by examining your system configuration that the Wifi interface is assigned the IP address 10.1.2.3, for example. Then you could listen on port 9002 of that interface by changing your server's run method to start the listen as follows:
std::error_code ec;
m_server.listen("10.1.2.3", "9002", ec);