Socket with recv-timeout: What is wrong with this code?

前端 未结 6 2208
难免孤独
难免孤独 2021-02-20 16:41

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         


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-20 17:05

    Nothing is wrong... The error code EAGAIN (Resource temporarily unavailable) is exactly what you should get after the timeout expires!

提交回复
热议问题