0
votes

I've created a socket, set it into nonblock state, got an addr by getaddrinfo, connected and then added it to the EPOLL with EPOLLIN | EPOLLOUT flags. On my next iteration of epoll_wait it got instantly triggered as EPOLLOUT but when i try to write\send data i get an EINPROGRESS(115) error. Any idea would be useful. Thanks

EDIT 0: I'm using LT epoll

EDIT 1: Question is invalid. I thought that when connection is finished it will trigger EPOLLIN as listener-socket do but it triggers EPOLLOUT. Thanks for you answers

1
Did connect completed?user58697
Are you saying that write or send returned -1 and an immediate check of errno returned EINPROGRESS? Can you show us the code from the call to write or send all the way to the code that detected the EINPROGRESS condition? Are you sure errno wasn't just still EINPROGRESS from a previous call to connect and you checked errno when there was no error?David Schwartz

1 Answers

0
votes

You are getting EINPROGRESS (which is not an error) because the socket is set to non-blocking ... so it's not blocking, at all. Are you sure you want to set it "into nonblock state"?

The point of using something like epoll is to avoid the whole blocking issue by being told when it's safe to use the socket.