safely switching between tcp and udp

Options
KevinB
KevinB
edited October 2014 in Native
Hi,

we are using a rather old cpp client build Photon 3.0.4.4. in the SDK, is there a way to switch between tcp and udp? looking at the code, the current way of setting tcp/udp protocol is when creating PhotonPeer. looks like it doesn't allow switching after initiating a PhotonPeer.

I also tried to destroy the PhotonPeer, and create a new instance, and Photon crashes internally. Thanks!

K

Comments

  • chvetsov
    Options
    Hi, KevinB.

    there is no way to change protocol on the fly. you just should disconnect and drop old instance of peer and create new one.
    If this does not work than it is our bug. we will take a look at it, but only on next week. our engineer on vacation today
  • KevinB
    Options
    that's what I did. I disconnect, destroy the old instance of photon peer and create a new one. when I connect again with the new instance, it crashes in the photon library. Thanks.

    K
  • Kaiserludi
    Options
    Hi KevinB.

    "when I connect again with the new instance, it crashes in the photon library".

    That should definitely just work without crashing.

    A shot in the dark:
    Can you please verify that you don't destroy and recreate the PhotonPeer instance from within a Photon callback. That would destroy the peer, on which service() is called, while service() gets executed, leading to undefined behavior, resulting most likely in a crash. Interestingly, recreating the peer with the same protocol, as well as switching from TCP to UDP, works without crashing for me even under these circumstances. Only switching from UDP to TCP causes a crash. However even those seemingly working cases are still undefined behavior.

    If my shot in the dark hasn't hit its target, then could you provide us with a self-contained reprocase for that crash, please? Aside from that undefined behavior case described above, I could not reproduce your problems. Destroying and recreating the peer with a different protocol works just fine for me (tested with the 3.0.4.4 Client on Windows).