FreeRTOS: Secure Sockets
Return to main page ↑
SOCKETS_Connect

Connects the socket to the specified IP address and port.

int32_t SOCKETS_Connect( Socket_t xSocket,
SocketsSockaddr_t * pxAddress,
Socklen_t xAddressLength );

The socket must first have been successfully created by a call to SOCKETS_Socket().

Note
To create a secure socket, SOCKETS_SetSockOpt() should be called with the SOCKETS_SO_REQUIRE_TLS option before SOCKETS_Connect() is called.

If this function returns an error the socket is considered invalid.

Warning
SOCKETS_Connect() is not safe to be called on the same socket from multiple threads simultaneously with SOCKETS_Connect(), SOCKETS_SetSockOpt(), SOCKETS_Shutdown(), SOCKETS_Close().

See the Berkeley Sockets API in wikipedia

Parameters
[in]xSocketThe handle of the socket to be connected.
[in]pxAddressA pointer to a SocketsSockaddr_t structure that contains the the address to connect the socket to.
[in]xAddressLengthShould be set to sizeof( SocketsSockaddr_t ).
Returns