-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Tso wrote:
> <!-- DIV {margin:0px;} -->
>
> Hi everyone, I'm having some problems using long poll
> implementation. I have a client event loop which is issuing a long
> poll packet. I was expecting the traditional 'comet
> <http://en.wikipedia.org/wiki/Comet_%28programming%29>' long poll
> <http://en.wikipedia.org/wiki/Comet_%28programming%29> behavior to
> be:
>
> 1. Client -> initiates connection with long poll packet 2. Server
> accepts connection, blocks until a. Server <- sends response packet
> -or- b. it times out (20 second elapses), disconnects 3. Goto Step
> 1. (client restablishes connection)
>
> Thus, I've implemented my event loops as follows:
>
> function onPacketReceive(String message) { Packet packets[] =
> parse(message);
>
> try { foreach (packet in Packets) { handlePacket(packet); } }
> finally { PokerClientConnection.establishLongPoll(); } }
>
> Am I making a faulty assumption with my client event loop? The
> behavior I'm getting is poll like behavior:
>
> 1. Client -> long poll packet 2. Server <- empty packet [] in 2
> seconds
>
> Why is the server sending me back empty packets? Should I
> restablish a connection at this point?
Hi,

The long poll implementation is as follows:

* LongPoll blocks and will return if the server issues a packet to the
client
* If the client is to send a packet to the server it must:
  * Send LongPollReturn
  * Wait for LongPoll to return as a side effect of LongPollReturn
  * Send the packet and retreive the result synchronously
  * Send a LongPoll

This is a little different from what you expect the usual long poll to
be. I suggest you look at the jpoker implementation to get a precise
algorithm that implements the above logic.
The trunk of poker-network also has a identical implementation in python.

Cheers

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksjdkEACgkQ8dLMyEl6F21WCgCcDSfyvDTMoUhn9BBLZgSR69P3
DVMAnRr7qeEwIpkUKXwLKNv4pN3G9Hi1
=kU8d
-----END PGP SIGNATURE-----

<<attachment: loic.vcf>>

_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users

Reply via email to