MyQttConn* myqtt_listener_new2 ( MyQttCtx ctx,
const char *  host,
int  port,
MyQttConnOpts opts,
MyQttListenerReady  on_ready,
axlPointer  user_data 

Creates a new MyQtt Listener accepting incoming connections on the given host:port configuration, receiving the port configuration as an integer value.

See myqtt_listener_new for more information.

Important note: you must call to myqtt_storage_set_path to define the path first before creating any listener. This is because creating a listener activates all server side code which among other things includes the storage loading (client subscriptions, offline publishing, etc). In the case direction, once the storage path is loaded it cannot be changed after restarting the particular context used in this operation (MyQttCtx).

ctxThe context where the operation will be performed.
hostThe host to listen to.
portThe port to listen to. Value defined for the port must be between 0 up to 65536.
optsOptional connection options to modify behviour
on_readyA optional notify callback to get when myqtt listener is ready to perform replies.
user_dataA user defined pointer to be passed in to on_ready handler.
The listener connection created, or NULL if the optional handler is provided (on_ready).

NOTE: the reference returned is only owned by the myqtt engine. This is not the case of myqtt_conn_new where the caller acquires automatically a reference to the connection (as well as the myqtt engine).

In this case, if your intention is to keep a reference for later operations, you must call to myqtt_conn_ref to avoid losing the reference if the system drops the connection. In the same direction, you can't call to myqtt_conn_close if you don't own the reference returned by this function.

To close immediately a listener you can use myqtt_conn_shutdown.

References MYQTT_IPv4.