Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: mingw status (server + lan server bugs)
Home

[Freeciv-Dev] Re: mingw status (server + lan server bugs)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: mingw status (server + lan server bugs)
From: Andreas Røsdal <andrearo@xxxxxxxxxxxx>
Date: Tue, 25 Nov 2003 21:36:00 +0100 (CET)

On Tue, 25 Nov 2003, Vasco Alexandre Da Silva Costa wrote:
> On Tue, 25 Nov 2003, Andreas Røsdal wrote:
> > On Tue, 25 Nov 2003, Vasco Alexandre Da Silva Costa wrote:
> > > On Tue, 25 Nov 2003, Andreas Røsdal wrote:
>
> > > > I think this is because the socket for UDP multicast is blocking,
> > > > even though it's set to be nonblocking.
> > > >
> > > > This can be fixed by using select(), like it's done several
> > > > places in /server/sernet.c.  I can make a patch for this.
> > >
> > > UDP is connectionless. Make sure you aren't getting bogged down doing
> > > a DNS name lookup.
> >
> > Ok. Here's the patch. The socket is not blocking any more,
> > and if DNS lookup fail, then the IP is shown instead.
>
> Eh no, you didn't understand. gethostbyname calls the resolver and I think
> gethostbyaddr calls it too. To make sure you don't block in the resolver,
> you need to use the integer address. You can convert a numbers and
> dots address (e.g. 190.130.36.2) using inet_addr or inet_aton to integer
> address format.  That will not call the resolver.
>
> Only use resolver calls to get the integer address from a DNS address
> (e.g. freeciv.org).
>
> You should find you do not need to use select at all since UDP is
> connectionless.

The function blocking is recvfrom(), now gethostbyname().
How do you get nonblocking sockets without using select(),
when my_nonblock() fails?

Per, does the patch fix the problem?

 Andreas Røsdal


[Prev in Thread] Current Thread [Next in Thread]