On OSX I keep getting a socket error of 316 after calling accept() on a bound & listening socket. I get a valid socket returned, and I believe I then use it fine, (though I may not be, I need to double check this, as I am accepting hundreds of connections at any moment) but errno has been set.
I'm trying to understand the documentation on the unix accept(2) man pages which notes (which, incidentally, is missing from apple's accept() documentation )
Linux accept() (and accept4()) passes already-pending network errors on the new socket as an error code from accept(). This behavior differs from other BSD socket implementations. For reliable operation the application should detect the network errors defined for the protocol after accept() and treat them like EAGAIN by retrying.
now, 316 works out as 256 OR'd with ETIMEDOUT(60). So, I'm curious as to how I should be handling this;
Do not examine errno
unless accept()
has returned -1. If accept()
returns a valid file descriptor then the value of errno
is undefined .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.