invalid argument (errno: 22)

socket communication example, when a client accept, often report this error.

And is the first time no problem, the second or later times will appear the following questions,

Error code 22, error description invalid argument.

 

Solve the problem as follows:

When obtaining the client socket fd, each time initialization sockaddr_in structure of the client,

sockaddr_in client_addr;

memset(&client_addr, 0, sizeof(client_addr));

Guess you like

Origin www.cnblogs.com/rohens-hbg/p/11950529.html