D
D
Danil Tunev2022-03-24 18:22:22
linux
Danil Tunev, 2022-03-24 18:22:22

How to bypass return of epoll_wait function?

Hello. So I decided to program the network on a low-level bible from the "box" of libraries from linux! Everything seems to add up, but there is one moment when a connection (accept) is caught from the listening sockets, it is added to the tracking set with epoll_white and immediately returns with event 4. How? Logically, if you connected to me, I expect "news" from you with the number 1. I don't understand this bug at all, or I have some kind of wedge in my brain. Of course, I ignore this event, but the system call works, how to get rid of it if, let's say, I have frequent tcp connection interruptions planned, it's a pipets how expensive and doesn't fit in with the logic, where did I miss?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2022-03-24
@lada-guy

when a connection (accept) is caught from listening sockets, it is added to the set for tracking by epoll_white and immediately returned with event 4. How? Logically, if you connected to me, I expect "news" from you with the number 1.

4 is EPOLLRDHUP? Logically, if you accepted an incoming connection, and the other side did shutdown(…, SHUT_WR) on it , so that data could only go from you to the client, then you will get this behavior.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question