6.2.3.4 connect

The connect function is used with TCP sockets to establish a new connection to a TCP server.

The connect function results in a SOCKET_MSG_CONNECT sent to the socket event handler callback upon completion. The connect event is sent when the TCP server accepts the connection or, if no remote host response is received, after a time-out interval of approximately 30 seconds.

Note: The SOCKET_MSG_CONNECT event callback provides a tstrSocketConnectMsg containing an error code. The error code value indicates:
  • Zero value to indicate the successful connection or
  • Negative value to indicate an error due to a time-out condition or if connect is used with UDP socket.
The following figure shows the ATWINC15x0 socket API connect to remote server host.
Figure 6-1. TCP Client API Call Sequence