#include <rtl.h>
int connect (
int sock, /* Socket descriptor */
SOCKADDR *addr, /* Pointer to address structure */
int addrlen); /* Length of address structure */
Description
The connect function assigns the address of the peer
communication end point. For SOCK_STREAM type socket, a
connection is established between the end points. For
SOCK_DGRAM type socket, an address filter is established
between the end points. The address filter is changed with another
connect function.
In blocking mode, which is enabled if the system detects RTX
environment, this functions waits for a connection establishment. In
non blocking mode, you must call the connect function again if
the error code SCK_EWOULDBLOCK is returned.
The argument sock specifies a socket descriptor returned
from a previous call to socket.
The argument addr is a pointer to the SOCKADDR structure
that contains the end point node IP address and port number.
The argument addrlen specifies the length of SOCKADDR
structure.
The connect function is in the RL-TCPnet library. The
prototype is defined in rtl.h.
note
You must call the socket function before any other
function calls to the BSD socket.
If a negative number is returned, it represents an error
code.
Return Value
The connect function returns the result code:
SCK_SUCCESS
The function call is successful.
SCK_EINVALID
The socket identified with sock is invalid, or in invalid
state.
SCK_EINVALIDPARA
The function parameters are invalid or not supported.
SCK_EWOULDBLOCK
The function would block, and the socket is set to non blocking
mode.
SCK_CLOSED
Remote end point has closed the connection.
SCK_ERROR
The function failed due to error in underlying native TCP
socket.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.