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: "Jackson, Craig (Gale)" <Craig.Jackson AT cengage.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] connect(2) for UDP
  • Date: Mon, 15 Dec 2008 09:21:13 -0500

I don't think this is true. I don't think connect(2) sends any packets
for UDP. It just sets up bookkeeping for subsequent write() and read()
calls.

However, I think after a write(), a subsequent read() may be able to learn
that it had gotten an ICMP Port Unreachable, which is the diagnostic
when no one is listening on a UDP port.

Craig

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of James K. Lowden
Sent: Monday, December 15, 2008 1:39 AM
To: TDS Development Group
Subject: [freetds] connect(2) for UDP

Hello Frediano!

/*
* Request the instance's port from the server.
* There is no easy way to detect if port is closed so we always try
to
* get a reply from server 16 times.
*/
for (num_try = 0; num_try < 16; ++num_try) {

But there is an easy way: use connect(2) and write(2) instead of sendto!
connect(2) sets errno to ECONNREFUSED if no one is listening to the port,
even for UDP.

This would let us know immediately if port 1434 is reachable, and could
reduce our retry loop to, say, three tries.

I was quite busy this weekend, as you see in the ChangeLog. Removing
tds->last_packet might cause some surprises, but seems to work.

Regards,

--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page