about disconnect

Options
ymlyjq
edited December 2013 in Photon Server
in server, peerbase,

when i called peer.Disconnect(),

then what happend ?

and what should me do?

for example:

client disconnect or i want to kill one client , only just call peer.Disconnect() ?

and how to recovery this peer ?

should me call peer.Dispose() ?

and if i call peer.Disconnect() for one peer too many times , what will hanpen ?

Comments

  • chvetsov
    Options
    When you call Disconnect(), you break connection with client. it will be brokent immediately. After this you will get OnDisconnect notification.
    >>and what should me do?
    well, you may clean up any resources associated with player, or save some parameters to recover connection later

    >>client disconnect or i want to kill one client , only just call peer.Disconnect() ?
    yes.

    >>and how to recovery this peer ?
    You are not able to recover this peer.

    >>should me call peer.Dispose() ?
    it is not necessary. Sdk will do it for you.

    >>and if i call peer.Disconnect() for one peer too many times , what will hanpen ?
    Do not worry, Player will be disconnected just one time and still will be able to connect next time.
  • e, thanks , Your description is to force;

    and then Another problem arises;

    in my case, i put user data into peer as it's Member variables,

    so if i can't recover this peer, i must set these Member variables = null ( class variables ) ? to avoid the memory leak ?
  • chvetsov
    Options
    >>so if i can't recover this peer, i must set these Member variables = null ( class variables ) ? to avoid the memory leak ?

    well, you should do like it is recommended for any managed program. if you member variable contains unmanaged resources you should dispose them in Dispose, else you may leave it without attention