Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: RFC Metaserver overhaul
Home

[Freeciv-Dev] Re: RFC Metaserver overhaul

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: RFC Metaserver overhaul
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Sat, 2 Nov 2002 22:22:11 +0000 (WET)

On Sat, 2 Nov 2002, Paul Zastoupil wrote:
> On Sat, Nov 02, 2002 at 04:24:52PM +0000, Vasco Alexandre Da Silva Costa 
> wrote:

> > Since the metaserver will know the server host and port why not make it
> > try to connect a socket to it every minute or so to check if its there or
> > not?
>
> Well, this is slightly more complicated.  This can't be done with only
> HTTP.  If we set a maximum time between updates (as well as a minimum
> as you mentioned above), and since this will now be TCP, we can assume
> a server is gone when its entry has aged over that amount.

That would waste a bit more bandwidth, but it is possible.
But PHP seems to have socket functions:

<http://www.php.net/manual/en/function.fsockopen.php>

So you could do something a bit like this:

$sock = fsockopen ($server, $port, $errno, $errstr, 3);
if (!$sock) {
  /* remove from list */
} else {
  /* do nothing */
  fclose($sock);
}

> reverse lookup from their ISP but a different forward.  But this still
> leaves an open issue if they are connecting through a proxy.

This comment seems useful:

<http://www.php.net/manual/en/function.gethostbyaddr.php>

---
<?
  if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){
    $IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
    $proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];
    $host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);
 }else{
    $IP = $HTTP_SERVER_VARS["REMOTE_ADDR"];
    $host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);
 }
?>

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa





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