This function receives data from a connected socket. To receive data on an unconnected socket, use the recvfrom() or recvmsg() functions. The received data is placed in the buffer buf. Data is sent by the socket's peer using the send, sendmsg(), sendto(), or write() functions. Use the select() function to determine when more data arrives. If no data is available at the socket, the recv() call waits for data to arrive, unless the socket is nonblocking. If the socket is nonblocking, a -1 is returned with the external variable errno set to EWOULDBLOCK. Related Functions See also read(), send(), sendmsg(), sendto(), and socket().