Name
tcp_connect() — Open connection to remote host
Synopsis
err_t tcp_connect
(
struct tcp_pcb *pcb
, struct ip_addr *ipaddr
, u16_t port
, err_t (*connected)
(
void *arg, struct tcp_pcb *tpcb, err_t err)
)
;
Description
Sets up pcb
to connect to the remote host indicated
by ipaddr
on port port
and
sends the initial SYN
segment which opens the connection.
The tcp_connect()
function returns immediately; it does
not wait for the connection to be properly set up. Instead, it will call the
function specified
as the fourth argument when the connection is established. If the connection
could not be properly established, either because the other host refused the
connection or because the other host didn't answer, the
connected()
function will be
called with its connected()
err
argument set accordingly.
Return value
The tcp_connect()
function can return
ERR_MEM
if no memory is available for enqueueing the
SYN
segment. If the SYN
indeed was
enqueued successfully, the tcp_connect()
function
returns ERR_OK
.
2024-03-18 | LWIP Documentation Notices |