how to send data's reliably through photon server

edited August 2011 in Photon Server
i am new to programming as well as new to use photon server. Currently i am sending the data using udp in my ios app.

When i send the data's from one player to another player through photon server , about 90%of the case i can able to receive it successfully. But in some bad case of remaining 10% i coudnt able to receive it. Can you pls guide me how to reduce this worst case percentage.

i am sending the data using udp non-reliable mode.
ie [m_pLitePeer opRaiseEvent :NO :ev :EV_PLAYER_INFO :0];
where ev ->NSMutableDictionary object.

if i modified the mode to Yes to send reliable send ie. [m_pLitePeer opRaiseEvent :YES :ev :EV_PLAYER_INFO :0];
In most case i am getting an error for disconnecting from the photon server( ). How can i solve this issuse ?

Thanks in advance.


  • Hi.
    It looks like your network connection is very unstable.
    If you network is not available for several seconds (which for mobile devices like the iPhone is much more common than for PC or Mac, when you move around, as wifi, umts, etc. is not available everywhere), unreliable messages will just get lost, but for reliable messages Photon will resend them multiple times, trying to get them through.
    However there is a timeout: It does not make any sense in a realtime game to try and send an operation for hours and thousands of times without getting it through.
    The default-values on iOS are: at max 5 retries and 10 seconds of retry time, whichever timeout triggers first.
    If a timeout triggers, than the client will handle the connection as being lost.

    So it seems, that your connection is so unstable, that this is not enough.

    You can change these timeout-values via the readwrite properties PhotonPeer.SentCountAllowance and PhotonPeer.SentTimeAllowance.

    In general you should use unreliable data, whenever the game can go on without the operation ever getting trough, if it have to, as reliable means, that all other data in the same channel will wait for that operation.

    You have to think about however, what value could be a reasonable timeout for the reliable stuff of your specific game to not got disconnected too often, but at the same time not letting the players waiting while retrying too long.