lwIP  2.1.0
Lightweight IP stack

Macros

#define netconn_listen(conn)   netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
 
#define netconn_write(conn, dataptr, size, apiflags)   netconn_write_partly(conn, dataptr, size, apiflags, NULL)
 

Functions

err_t netconn_listen_with_backlog (struct netconn *conn, u8_t backlog)
 
err_t netconn_accept (struct netconn *conn, struct netconn **new_conn)
 
err_t netconn_recv_tcp_pbuf (struct netconn *conn, struct pbuf **new_buf)
 
err_t netconn_recv_tcp_pbuf_flags (struct netconn *conn, struct pbuf **new_buf, u8_t apiflags)
 
err_t netconn_write_partly (struct netconn *conn, const void *dataptr, size_t size, u8_t apiflags, size_t *bytes_written)
 
err_t netconn_close (struct netconn *conn)
 
err_t netconn_shutdown (struct netconn *conn, u8_t shut_rx, u8_t shut_tx)
 

Detailed Description

TCP only functions

Macro Definition Documentation

◆ netconn_listen

#define netconn_listen (   conn)    netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)

◆ netconn_write

#define netconn_write (   conn,
  dataptr,
  size,
  apiflags 
)    netconn_write_partly(conn, dataptr, size, apiflags, NULL)

Function Documentation

◆ netconn_accept()

err_t netconn_accept ( struct netconn conn,
struct netconn **  new_conn 
)

Accept a new connection on a TCP listening netconn.

Parameters
connthe TCP listen netconn
new_connpointer where the new connection is stored
Returns
ERR_OK if a new connection has been received or an error code otherwise

◆ netconn_close()

err_t netconn_close ( struct netconn conn)

Close a TCP netconn (doesn't delete it).

Parameters
connthe TCP netconn to close
Returns
ERR_OK if the netconn was closed, any other err_t on error

◆ netconn_listen_with_backlog()

err_t netconn_listen_with_backlog ( struct netconn conn,
u8_t  backlog 
)

Set a TCP netconn into listen mode

Parameters
connthe tcp netconn to set to listen mode
backlogthe listen backlog, only used if TCP_LISTEN_BACKLOG==1
Returns
ERR_OK if the netconn was set to listen (UDP and RAW netconns don't return any error (yet?))

◆ netconn_recv_tcp_pbuf()

err_t netconn_recv_tcp_pbuf ( struct netconn conn,
struct pbuf **  new_buf 
)

Receive data (in form of a pbuf) from a TCP netconn

Parameters
connthe netconn from which to receive data
new_bufpointer where a new pbuf is stored when received data
Returns
ERR_OK if data has been received, an error code otherwise (timeout, memory error or another error,
See also
netconn_recv_data) ERR_ARG if conn is not a TCP netconn

◆ netconn_recv_tcp_pbuf_flags()

err_t netconn_recv_tcp_pbuf_flags ( struct netconn conn,
struct pbuf **  new_buf,
u8_t  apiflags 
)

Receive data (in form of a pbuf) from a TCP netconn

Parameters
connthe netconn from which to receive data
new_bufpointer where a new pbuf is stored when received data
apiflagsflags that control function behaviour. For now only:
  • NETCONN_DONTBLOCK: only read data that is available now, don't wait for more data
Returns
ERR_OK if data has been received, an error code otherwise (timeout, memory error or another error,
See also
netconn_recv_data) ERR_ARG if conn is not a TCP netconn

◆ netconn_shutdown()

err_t netconn_shutdown ( struct netconn conn,
u8_t  shut_rx,
u8_t  shut_tx 
)

Shut down one or both sides of a TCP netconn (doesn't delete it).

Parameters
connthe TCP netconn to shut down
shut_rxshut down the RX side (no more read possible after this)
shut_txshut down the TX side (no more write possible after this)
Returns
ERR_OK if the netconn was closed, any other err_t on error

◆ netconn_write_partly()

err_t netconn_write_partly ( struct netconn conn,
const void *  dataptr,
size_t  size,
u8_t  apiflags,
size_t *  bytes_written 
)

Send data over a TCP netconn.

Parameters
connthe TCP netconn over which to send data
dataptrpointer to the application buffer that contains the data to send
sizesize of the application data to send
apiflagscombination of following flags :
  • NETCONN_COPY: data will be copied into memory belonging to the stack
  • NETCONN_MORE: for TCP connection, PSH flag will be set on last segment sent
  • NETCONN_DONTBLOCK: only write the data if all data can be written at once
bytes_writtenpointer to a location that receives the number of written bytes
Returns
ERR_OK if data was sent, any other err_t on error