Author Topic: OnNetworkDisconnect does not work  (Read 2722 times)

savely00

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
OnNetworkDisconnect does not work
« on: January 17, 2014, 12:29:14 AM »
I am working on PC based multi-player game. Sometimes during the game the TNServer crashes. I tried to use OnNetworkDisconnect and OnNetworkError but I do not receive notifications. I placed the script with the following fragment on the MainCamera. Please Help.
..........................................................................................
disconnect = false;

void OnNetworkDisconnect() { disconnect = true; }
void OnNetworkError (string error) { disconnect = true; }

void OnGUI () {
    if (disconnect)
    { GUI.Label(new Rect(10, 10, 105, 40), "DISCONNECTED"); }
}
« Last Edit: January 17, 2014, 11:43:32 AM by savely00 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: OnNetworkDisconnect does not work
« Reply #1 on: January 17, 2014, 12:40:44 AM »
What crashes? If the application crashes, there won't be any OnGUI, so I'm guessing it's the remote client that crashes? So what are you seeing, the 2nd player remains connected? You need to be more precise here. The connection will be kept for up to 10 seconds before TNet realizes that it's no longer active and sends the disconnection message.

savely00

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: OnNetworkDisconnect does not work
« Reply #2 on: January 17, 2014, 11:42:40 AM »
Sorry. TNServer crashes. To reproduce, I start two TNServer and two instances. After both instances are initialized I kill the TNServer. None of the instances receive the notification. Note: I run both instances as well as TNServer on the same machine.
« Last Edit: January 17, 2014, 06:29:09 PM by savely00 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: OnNetworkDisconnect does not work
« Reply #3 on: January 20, 2014, 01:28:56 AM »
So... does it crash, or do you kill it? As they are not one and the same. ;)

TNServer.exe is stable as a rock from my experience. Starlink had two TNServers running (one lobby server and one game server) for the past 7 months without any issues. That's 7 months up-time of players coming and going. If you do manage to crash it somehow, I'd be interested to know how so I can fix it. If you kill it... that's a different story. As I mentioned, the TNet clients should realize that the connection is dead after ~10 seconds.

savely00

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: OnNetworkDisconnect does not work
« Reply #4 on: January 20, 2014, 03:23:55 PM »
ArenMook,
We are working on a multi-player game where it make sense to run multiple instances of the game on one machine. We have active players, that usually run on separate machines, and we have passive instances (PTZ cameras). When we ran multiple cameras on one machine, resource use is going crazy and processor overheats :-[. Usually server crashes in those conditions. But computer is not crashing. We noticed that we do not receive notification in the active player instances that TNServer has crashed.
For testing purposes I kill TNServer intentionally. I still do not receive the notification even after 5 minutes.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: OnNetworkDisconnect does not work
« Reply #5 on: January 21, 2014, 04:22:23 AM »
Alright, I'll see if I can repro it on my end.