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.
|