Skip to Content.
Sympa Menu

freetds - Re: [freetds] connect(2) for UDP

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: christos AT zoulas.com (Christos Zoulas)
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] connect(2) for UDP
  • Date: Thu, 18 Dec 2008 13:35:48 -0500

On Dec 18, 1:20pm, jklowden AT freetds.org ("James K. Lowden") wrote:
-- Subject: Re: [freetds] connect(2) for UDP

| Christos Zoulas wrote:
| > Always prefer poll over select on systems that have it.
|
| http://www.unixguide.net/network/socketfaq/2.14.shtml

This is a bit out of date... Most systems have poll() today, and actually
some have also enhanced versions (like NetBSD's pollts or linux's epoll*)
I think I've mentioned why poll is superior to select before, but here it
is again:

1. Expensive because you need do operations on bitmasks [ffs/shifts].
2. Expensive because you need to reset the masks before each call.
3. Non portable behavior for >= 256 fd's. All systems need source
recompilation; some older systems need kernel recompilation.
4. Non-portable behavior with respect to ERESTART.
5. Non-portable behavior when running out of resources. The only
way to fix this is using non-blocking-io which is a bit of a pain.
6. Non-portable behavior with respect to "struct timeval *timeout".
This is non-const, and it was originally intended to return
the time left. Most implementations did not change "timeout", but
one or two did, so it is always good to re-initialize "timeout".
7. Can only report 3 types of events, read/write/except.

|
| "Someone could write an implementation of poll() that uses select()"
|
| http://www.sealiesoftware.com/fakepoll.h
|
| Perhaps we should add this to replacements and always call poll().

Sure, that is not a big deal.

christos




Archive powered by MHonArc 2.6.24.

Top of Page