can we force particular connection say TCP or UDP in photon?

edited September 2011 in Photon Server

I am using marmalade c++ with photon, I run the demo application came along with it i.e. demo_marmalade_photon_cpp

it uses UDP server setting for IP & port, is it possible to force application to only use TCP connection for data transmission in photon?


  • Hi Paresh. The currently published Marmalade-clients do not support tcp. This will change with their next Major-release, when you can simply pass a bool-flag, to the Peer-constructor, stating if you want to use udp or tcp.
    Is there any particular reason, why you want to use tcp, exclusively. You can still communicate with tcp-only clients, when you are using udp and with reliable udp you have reliability, too. The only situation, where tcp is a must-have, is, when you are hosting the server somewhere, where udp is currently not allowed, for example on Azure.
  • thanks for your reply.

    thing is that I am starting with turn based card game, so i am bit worried about assurance of message passing to all users.
    is it possible that any of the message get lost during transmission? if that happen then game can crash or freeze.

    one more thing, is there any chat example available for C++ users like Chatroom and Lobby Demo in C# ?
    it will be great help to understand flow of information & implementation.

  • KaiserludiKaiserludi admin
    edited September 2011
    You should of course still make reasonable sure, that your game is not just freezing or crashing, if the internet-connection is unstable. Photon guarantees for both, tcp and reliable udp, that you get all messages and that you get them in the correct order, as long, as you can get anything at all. Of course, if you loose your connection completely, then with no Protocol you could receive or send anything anymore. So reliable udp will just suit your needs the same way as tcp would.

    No, currently there is no chat-demo in C++ available and it is not planned for the near future, sorry.
  • thanks for your reply, now I am confident about UDP.
  • I was discussing about topic with my friends, we try to understand how reliable udp is working but didn't come out with good explanation. can you please explain me how reliability is achieve in this case. When you are saying it's reliable UDP then how it is internally achieve, is it maintaining some information about message sending, like indexing or something so that all message will received in correct order.

    It will be great help in understanding if you can refer to files which doing this internally or explain me how it is done in photon.

  • We use a custom port of enet ( internally to achieve reliable udp.

    So, while tcp always is reliable, no matter if reliability is needed for a specific operation, with choosing udp you can choose, every time, when you send an operation, if you want to send it reliable or unreliable.

    enet is open source, so you can look at it's source, if you are interested.
  • thanks... :)
Sign In or Register to comment.