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: Peter Deacon <peterd AT iea-software.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] connect(2) for UDP
  • Date: Wed, 17 Dec 2008 11:24:01 -0800 (Pacific Standard Time)

On Wed, 17 Dec 2008, James K. Lowden wrote:

Possible conditions:

1. gethostbyname() fails. Don't try 1434.
2. connect/write/read to 1434 succeeds. Hurrah!
3. connect/write/read to 1434 yields ECONNREFUSED. Named instances
unsupported.
4. connect/write/read to 1434 times out. Host down *or* host responding
from different interface.

Well, first try connected. It's quicker if it works, and it establishes
(#3) whether or not anyone's listening to 1434.

For autodetection, for #4 I would assume the host is down, because
retrying is too slow (especially if it's actually a 5.0 server). But if,
say, freetds.conf had "port = AUTO", then I'd try unconnected UDP. I'm
also tempted to fork(2) and try both at the same time. (The child could
write the results to the parent via a pipe.)

Recommend using bind() rather than connect() with UDP. With bind you still get ICMP indiciations for fast failure when send()ing.

Have Fun!
Peter




Archive powered by MHonArc 2.6.24.

Top of Page