[Freeciv-Dev] Re: RFC Metaserver overhaul
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
- [Freeciv-Dev] RFC Metaserver overhaul, Paul Zastoupil, 2002/11/01
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Vasco Alexandre Da Silva Costa, 2002/11/02
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Raimar Falke, 2002/11/02
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Vasco Alexandre Da Silva Costa, 2002/11/02
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Reinier Post, 2002/11/05
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Peter Dam Mains, 2002/11/05
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Paul Zastoupil, 2002/11/05
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Paul Zastoupil, 2002/11/05
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Reinier Post, 2002/11/06
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Vasco Alexandre Da Silva Costa, 2002/11/06
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Ben Webb, 2002/11/07
- [Freeciv-Dev] Re: RFC Metaserver overhaul, Vasco Alexandre Da Silva Costa, 2002/11/07
|
|