Name
netconn_new_with_callback() — Create a new connection structure with a callback
Synopsis
struct netconn *netconn_new_with_callback
(
enum netconn_type type
, void (*callback)
(
struct netconn *conn, enum netconn_evt evt, u16_t len)
)
;
Description
This function is similar to netconn_new()
except that an additional function pointer callback
is
passed. The function pointed to by callback
will be called
when data is sent or received. Specifically, the netconn_evt
parameter to the callback is used to indicate the event type. This enum can have
the following values:
- NETCONN_EVT_RCVPLUS
-
Used when new incoming data from a remote peer arrives. The amount of data
received is passed in
len
. Iflen
is 0 then a connection event has occurred: this may be an error, the acceptance of a connection for a listening connection (called for the listening connection), or deletion of the connection. - NETCONN_EVT_RCVMINUS
-
Used when new incoming data from a remote peer has been received and accepted
by higher layers. The amount of data accepted is passed in
len
. Iflen
is 0 then this indicates the acceptance of a connection as a result of a listening port (called for the newly created accepted connection). - NETCONN_EVT_SENDPLUS
-
Used when data has been sent to a remote peer and received by it. This only
occurs for TCP connections, and specifically is only triggered when, as a
consequence of TCP acknowledgements from the remote peer, the free TCP send
buffer size now exceeds the configured send buffer low water mark
(configured with the
CYGNUM_LWIP_TCP_SNDLOWAT
CDL configuration option). The amount of data sent in the most recent transaction is passed inlen
. Iflen
is 0 then this indicates the connection has been deleted. - NETCONN_EVT_SENDMINUS
-
This is only used for TCP connections, and is triggered when
a sufficient amount of data has been sent on the connection that the
amount of free send buffer space is now under the send buffer low
water mark (configured with the
CYGNUM_LWIP_TCP_SNDLOWAT
CDL configuration option). The amount of data sent in the most recent transaction is passed inlen
. - NETCONN_EVT_ERROR
-
This is only used for TCP connections, and is triggered when an error has
occurred or a connection is being forced closed. It is used to
signal
select()
.
2024-03-18 | LWIP Documentation Notices |