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: "Frediano Ziglio" <freddy77 AT gmail.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] connect(2) for UDP
  • Date: Wed, 17 Dec 2008 10:35:39 +0100

2008/12/15 James K. Lowden <jklowden AT freetds.org>:
> 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.
>

Mmmm... from comments

/*
* on cluster environment is possible that reply packet came from
* different IP so do not filter by ip with connect
*/

the problem is not that easy... if server has two interfaces
configured server reply from a single interface so it can happen that
client ask to an interface with a given IP but server reply from
another IP, in such situation with connect used recv don't receive
server reply :( I think we can solve this problem using two sockets,
one connected and another not connected.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page