Re: Nonblocking socket



Henrik Goldman wrote:
Hi,

Following the documentation on hp-ux I set my socket as non-blocking:

int nFlags;

nFlags = fcntl(ListenSocket, F_GETFL, 0);

nFlags |= O_NONBLOCK;

if (fcntl(ListenSocket, F_SETFL, nFlags) == -1)

return false;



This actually to work fine but what I don't understand is that accept() returns errno 2 (ENOENT) instead of EAGAIN or EWOULDBLOCK like the documentation says.

Can anyone shed some light on this?

The error code that I get is not even mentioned in the manpage for accept.

Which protocol family ? Socket is just a entry point for
several protocol families, so a bug in the accept entry
routine of the specific PF could cause the system call
accept() to return an unexpected error.

Following is just my guess - if you are using PF which
does not support NONBLOCKing sockets, then it might
return ENOENT (which in practice should return ENOTSUP).
Does the accept work okay with a blocking socket ?

--vishwas
.



Relevant Pages

  • Re: Socket.Disconnect Method
    ... Although the exception list in the MSDN documentation ... Windows XP SP2. ... An error occurred when attempting to access the socket. ... use the SocketException.ErrorCode property to obtain the specific error code. ...
    (microsoft.public.vsnet.general)
  • Re: Socket.Disconnect Method
    ... According to the documentation for this method, ... An error occurred when attempting to access the socket. ... It looks to me like the underlying error code could have been: ... This method ends the connection and sets the Connected ...
    (microsoft.public.vsnet.general)
  • Re: [Q] How to Forumulate HTTP request using fsockopen() / fputs()
    ... I can find no documentation ... Frame HTTP Request Command. ... Write the command to socket. ... access have FTP access. ...
    (comp.lang.php)
  • Re: Nonblocking send. Is it a BUG in Windows Socket API?
    ... WinSock documentation. ... sendfunction must not return WSAENOBUFS error ... > regardless of the socket is blocking or nonblocking. ...
    (microsoft.public.win32.programmer.networks)
  • send(2) does not block, send(2) man page wrong?
    ... I cannot get send (or sendto which is what really interests me) ... to block on FreeBSD 4.9. ... When I send as fast as I can to a socket, ... Is the documentation for sendwrong or is there some way to make ...
    (freebsd-hackers)