I\'m trying to implement a socket with a recv timeout of 1 Second:
int sockfd;
struct sockaddr_in self;
struct sockaddr_in client_addr;
int addrlen=sizeof(clien
Which socket do you want to have the one-second timeout on? The one accepting connections, or the one established by accept()?
I'd assume the latter - so try setting the receive timeout on clientfd AFTER the accept returns. You can also get to where you need to be using select, but you shouldn't need to.