[ENet-discuss] ENet and PHP's socket library

Kevin Gadd kevin.gadd at gmail.com
Wed Sep 26 10:16:16 PDT 2007


Using enet to query for statistics also means that every machine making
these queries would be eating away at your game server's connection limit,
which isn't remotely ideal. You'd also be incurring the overhead involved in
setting up an enet connection, and you'd have to be able to use UDP to reach
your webserver (most webservers are going to be behind a firewall which may
or may not forward UDP packets)

Instead of having your PHP server(s) poll the game server for statistics,
why not have the game server(s) send heartbeat statistics to the PHP
server(s) periodically? Heartbeat statistics are the method used by most
game servers, and they're much easier to implement - you can basically just
fire off a GET or POST to your web server with the appropriate statistics in
the request, and forget about it. If you feel like you want something more
flexible, you could use XMLRPC, SOAP, or something similar, since there are
good libraries for doing those in PHP.

On 9/26/07, Bjørn Lindeijer <bjorn at lindeijer.nl> wrote:
>
> Looking back at what you're trying to achieve, I'd have to ask why do
> you want to use ENet just to query some statistics? Since this needs
> sequenced and reliable communication anyway, the easiest thing to do in
> my opinion is to use a basic TCP socket separate from the socket(s)
> driven by the ENet protocol.
>
> Bjørn
>
> GhostManZero wrote:
> > That was what i feared the most, i wonder if i'll be able to do some
> > bindings for ENet then, considering how i've never written any
> > bindings for any languages before...
> >
> > Also, my main language is C++.
> >
> > Quoting Giuseppe Greco <giuseppe.greco at agamura.com>:
> >
> >> To connect to an ENet server you need an ENet client since both peers
> >> must implement the same protocol (or if you prefer "talk the same
> >> language"). You cannot just use a raw socket and expect it is able to
> >> communicate with an ENet server. Of course, ENet provides also a simple
> >> socket API (enet_socket_...) but it just hides the differences between
> >> the Socket API on Windows and the Socket API on UNIX.
> >>
> >> What you can do is to write PHP bindings for ENet (I don't know if
> >> they already exist - I use to program in C, period).
> >>
> >> j3d.
> >>
> >>>
> >>>    Hello everyone,
> >>>
> >>>    I would like to know if it would be possible to use PHP's socket
> >>> library to connect to a ENet server and be able to send and receive
> >>> messages, as i'd like to try to do a simple PHP script where my script
> >>> connects to a ENet Game Server and fetches the total ammount of
> >>> players online.
> >>>
> >>>    Would such thing be possible under PHP? If so, would anyone mind
> >>> telling me a bit of how i should proceed?
> >>>
> >>>    I'm not a PHP newbie, so if you just point me out to the functions
> >>> i must use, and in what way, i can take care of it myself.
> >>>
> >>>    Thank you for your time!
> >>> --
> >>> ~Zero
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cubik.org/pipermail/enet-discuss/attachments/20070926/4c5c1416/attachment.htm 


More information about the ENet-discuss mailing list