Re: Programming technique for non-forking servers?

From: Terry Lambert <[email protected]>
Date: Wed, 13 Nov 1996 13:54:54 -0700 (MST)

> 3) getpeername()
>
> Works everywhere, but looses the connect error...
>
> Oh, and don't forget that sometimes connect() will return immediately, even
> if the socket is non-blocking, so you have to check for all possible states
> (success, non-blocking, or error). And be carefull, connect() can return
> different values for non-blocking on different OS's (EINPROGRESS,
> EWOULDBLOCK, etc.)

If you are running a server, then the event *must* be that the data
*is* available.

Therefore you should *always* use blocking sockets.

I think the async connect is not an issue, since as a server, all
connections are *inbound*, not outbound. You use "accept", not
"connect".

                                        Terry Lambert
                                        terry@lambert.org

---
Any opinions in this posting are my own and not those of my present
or previous employers.
Received on Wed Nov 13 1996 - 13:07:03 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:33:32 MST