MyQttConn * myqtt_conn_new_empty ( MyQttCtx ctx,
MYQTT_SOCKET  socket,
MyQttPeerRole  role 
)

Allows to create a new MyQttConn from a socket that is already connected.

This function only takes the given underlying transport descriptor (that is, the socket) and gets the remote peer name in order to set which is the remote host peer.

This function also sets the default handler for sending and receiving data using the send and recv operations. If you are developing a MQTT solution which needs to notify the way data is actually sent or received you should change that behaviour after calling this function. This is done by using:

Parameters
ctxThe context where the operation will be performed.
socketAn already connected socket.
roleThe role to be set to the connection being created.
Returns
a newly allocated MyQttConn.