Recv () with errno = 107: (linked transport point)

well..I use a typical epoll + multithread model to handle massive sockets, i.e. I have a thread called epollWorkThread that uses epoll_wait to handle i / o sockets. Although there is an EPOLLIN event, recv () will do the job, and I use the noblocking mode to return immediately. And recv () is really after a while (true) loop. Everything is all right in the main time (maybe in a couple of hours or maybe minutes or if I’m lucky), I can get information. But after a while, recv () insists on returning -1 with errno = 107 (ENOTCONN). Another peer-to-peer transport is written in AS3, which provides a socket connection. Therefore, the behavior of recv () confuses me. Thank you in advance for any comment!

+4
source share
1 answer

Errno 107 means that the socket is NOT connected (no more). There are several reasons why this could happen. Assuming you're right and both sides of the connection claim that the socket is still open, the intermediate router / switch may reset the connection due to a timeout. The safest way to avoid such events is to periodically send a “health” or “keep alive” message. (Thus, the intermediate router / switch accepts the connection as living ...) =

+3
source

Source: https://habr.com/ru/post/1299309/


All Articles