The accept_and_recv function call is explained in this sample program. The server opens a socket to which it binds and then does a listen on that socket. It starts the number of specified threads and does accept_and_recv on each of them. The client opens a socket, connects to the server and sends the data. As the timeout option is set (by using setsockeopt), whenever the client connects but doesn't send any data, the server times out.