The accept function accepts a connection request queued for a listening socket. If a connection request is pending, accept removes the request from the queue, and a new socket is created for the connection. The original listening socket remains open and continues to queue new connection requests. The socket sock must be a SOCK_STREAM type socket. In blocking mode, which is enabled if the system detects RTX environment, this functions waits for a connection request. In non blocking mode, you must call the accept 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 will receive the connection node IP addres and port number. The argument addrlen is a pointer to the address length. It should initially contain the amount of space pointed to by addr. On return it contains the actual length of the address returned in bytes. The accept 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.
|