Re: Network Programming Models (was OTCountFreeBytes?)
Re: Network Programming Models (was OTCountFreeBytes?)
- Subject: Re: Network Programming Models (was OTCountFreeBytes?)
- From: Quinn <email@hidden>
- Date: Mon, 4 Feb 2002 19:24:26 +0000
At 11:00 -0800 4/2/02, Duane Murphy wrote:
I am curious about this comment (bletch). I am new to unix network
programming and this seemed to be a fairly powerful non-blocking way of
dealing with sockets.
What am I missing?
"bletch" is my own personal bias. Sorry.
However, non-blocking sockets and select do have a number of problems
that aren't the result of my bias.
o You can only select on a limited number of file descriptors
simultaneously. This limit, FD_SETSIZE, is currently 1024, which is
way too limiting for a serious server product.
o select just returns when something happens--it doesn't tell you
what happened. So you have to walk each of your fd_set's (these are
parameters to select, type "man select" in Terminal for the gory
details) looking for the ones that fired. For large fd_sets this can
be slow.
o select results in a programming model just like OT notifiers:
everything has to be a state machine. Having grown up on the Mac I
don't mind this programming model--it actually feels kinda
normal--but I've debugged enough developer code to convince me that
not everyone else feels the same way.
If you're new to UNIX network programming I highly recommend "UNIX
Network Programming" (ISBN: 013490012X) by Stevens. This is one of
the best programming books I've ever read on any topic.
<
http://www.amazon.com/exec/obidos/ASIN/013490012X/qid=1012850481/
sr=8-2/ref=sr_8_71_2/002-9091064-8801624>
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware