1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

lws_get_vhost_listen_port

This commit is contained in:
Andy Green 2018-04-27 09:01:41 +08:00
parent 7ff8f023d1
commit c9fb42bb8f
2 changed files with 23 additions and 1 deletions

View file

@ -2508,6 +2508,12 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
return port;
}
LWS_VISIBLE LWS_EXTERN int
lws_get_vhost_listen_port(struct lws_vhost *vhost)
{
return vhost->listen_port;
}
#if defined(LWS_WITH_IPV6)
LWS_EXTERN unsigned long
lws_get_addr_scope(const char *ipaddr)

View file

@ -2686,7 +2686,11 @@ struct lws_context_creation_info {
/**< VHOST: Port to listen on. Use CONTEXT_PORT_NO_LISTEN to suppress
* listening for a client. Use CONTEXT_PORT_NO_LISTEN_SERVER if you are
* writing a server but you are using \ref sock-adopt instead of the
* built-in listener */
* built-in listener.
*
* You can also set port to 0, in which case the kernel will pick
* a random port that is not already in use. You can find out what
* port the vhost is listening on using lws_get_vhost_listen_port() */
const char *iface;
/**< VHOST: NULL to bind the listen socket to all interfaces, or the
* interface name, eg, "eth2"
@ -5918,6 +5922,18 @@ lws_compare_time_t(struct lws_context *context, time_t t1, time_t t2);
LWS_VISIBLE LWS_EXTERN struct lws_context * LWS_WARN_UNUSED_RESULT
lws_get_context(const struct lws *wsi);
/**
* lws_get_vhost_listen_port - Find out the port number a vhost is listening on
*
* In the case you passed 0 for the port number at context creation time, you
* can discover the port number that was actually chosen for the vhost using
* this api.
*
* \param vhost: Vhost to get listen port from
*/
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_get_vhost_listen_port(struct lws_vhost *vhost);
/**
* lws_get_count_threads(): how many service threads the context uses
*