tcp_connect() function
Connects to another host. The function given as the "connected" argument will be called when the connection has been established. Sets up the pcb to connect to the remote host 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 setup. Instead, it will call the function specified as the fourth argument (the "connected" 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 "err" callback function of this pcb (registered with tcp_err, see below) will be called. 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.
Arguments
pcb
the tcp_pcb used to establish the connection
ipaddr
the remote ip address to connect to
port
the remote tcp port to connect to
connected
callback function to call when connected (on error, the err calback will be called)
Return value
ERR_VAL if invalid arguments are given ERR_OK if connect request has been sent other err_t values if connect request couldn't be sent
Examples
tcp_connect() is referenced by
3 libraries and example projects.
Functions calling tcp_connect()
Functions called by tcp_connect()
tcp_connect()
printf() all items filtered out
Data read by tcp_connect()
Data written by tcp_connect()
tcp_connect()
Type of tcp_connect()
tcp_connect()