Re: Net_GSQ API Question
| From: | Aidan Lister | Date: | Fri, 23 Apr 2004 01:27:21 +0000 |
| Subject: | Re: Net_GSQ API Question | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-28271@lists.php.net to get a copy of this message | ||
"David Grant" <david@grant.org.uk> wrote in message
news:4087C249.8060102@grant.org.uk...
> Aidan,
>
> Aidan Lister wrote:
> > If a connection to a server fails, there is a 1000ms delay in the socket
> > before it's killed (this is minimum). That happening 4 times is a
problem.
>
> This would only occur if you were creating a socket four times though.
> Why not create the socket on instantiation, then test the socket for
> signs of life before you throw something down it.
Because it's a UDP query, it'll stay happily connected to "null" until you
try and read from it.
>
> >>I would've thought an array to be a more appropriate argument to the
> >>query method than multiple length arguments.
> >
> >
> > Yeh, It could be done either way, I think the overloading is nicer.
>
> You'll be returning in an array, but the design choice is up to you.
>
> >>Personally I would stick
> >>with the seperate methods, as it leaves the API obvious.
> >>
> >
> > Requests can't be concatenated, this is a big problem if you're querying
10
> > servers. It would be 4 times slower (with the gamespy protocol) sending
each
> > request seperatly.
>
> How about collecting all the information the implementor requires, then
> ask them to call another method to start the retrieval. For example:
>
> $server = new Net_GamesServerQuery($ip, $port, $game);
>
> $server->requestFoo();
> $server->requestBar();
> $server->requestBaz();
>
> $results = $server->sendQuery();
Hey, I like that!
>
> >>If someone
> >>wants to alter it, then the license allows them to do so.
> >
> > Well sure, but we're aiming to release top quality stuff, not quality
stuff
> > that can be improved :)
>
> That's a fair point!
>
> Regards,
>
> David