[ENet-discuss] ENet and PHP's socket library
GhostManZero
ghostmanzero at lutherlink.de
Thu Sep 27 00:52:58 PDT 2007
The only problem about that is that it's supposed to be a realtime
game, where the game server is a program and the game "client" is the
PHP pages, so sending information periodically would only make the
game "slow-stepped".
Maybe i should just quit the idea altogether and do a "normal" PHP game.
Quoting Kevin Gadd <kevin.gadd at gmail.com>:
> 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
>>
>
--
~Zero
More information about the ENet-discuss
mailing list