Receiving failed. SocketException: ConnectionReset

Hello. I am showing a Unity Ads rewarded video ad in my game. When the ad is completed and I close it, I get the following log and photon is disconnected:

Receiving failed. SocketException: ConnectionReset




Please tell me how to fix it. Thanks.

Best Answer


  • Hi @kashiftasneempro,

    Thank you for choosing Photon!

    What PUN version are you using?
    On what platform did you get these errors? iOS I guess.
    How long does a video ad take?
  • @JohnTube , my PUN version is 1.81. Yes, I am getting these errors on iOS. Video ad takes about 30 seconds.
  • @JohnTube Can you please explain what are the functions to call disconnect and reconnect to join same room?
    And if i disconnect the signal will sent to opponent player also and It will result in winning the opponent when the player disconnected. Whats the solution?
    In my case i used PhotonNetwork.ReconnectAndRejoin(). But it is not working because i can see a debug showing "Receiving failed. SocketException: ConnectionReset" resulting leave room also, So my opponent is winning in each case.
  • Hi @Avinash_Juego,

    Thank you for choosing Photon!

    You should handle the remote player disconnect event on opponents differently depending on the "type" of leave event/callback.
    First, make sure you create rooms with PlayerTTL set in milliseconds to the period you want players to take to reconnect and rejoin same room. -1 or int.MaxValue means infinity, the player can rejoin any time as long as the room can be re joinable.
    When a player disconnects unexpectedly or leaves a room with the intention of coming back later, the others will get the callback
    OnPhotonPlayerActivityChanged(PhotonPlayer otherPlayer)
    then check the otherPlayer.IsInactive.
    If a player leaves the room for good (rage quit, abadon, etc.) you get:
    OnPhotonPlayerDisconnected (PhotonPlayer otherPlayer)
Sign In or Register to comment.