Game Development Community

Am I connected?

by Dreamer · in Torque Game Engine · 04/19/2005 (10:07 am) · 5 replies

Hello all, at the moment I have edited the connect function to set a global flag when called, I am using this to tell whether a connection has already been established or not, between client and server.

My only problem is that if the server or client drops connection that flag is still set to true.

I'm thinking there HAS to be an easier way to tell if I currently have an open GameConnection.

I've tried dumping %conn and I'm not seeing anything along the lines of %conn.isConnected(), that I can run a check against.

Any ideas?

#2
04/19/2005 (3:34 pm)
I belive there are GameConnection::onConnectionDropped() callbacks see if they help you any
#3
04/19/2005 (3:38 pm)
Yeah I'm trying to minimize callback usage here, and just be able to determine the state of the current connection if one exists.
It should basically be something along the lines of...
if(!%conn.isConnected()){
     connect($JoinGameAddress, $Pref::Player::Name);
}else{
     LoginAccount();
}

Rather than my current make shift solution which is to place a Global inside the connect function itself, and then inside of each and every connection state callback.
$WeAreConnected =1;
#4
04/20/2005 (12:40 am)
Why not just check to see if there is an object called ServerConnection? That's the usual method of determining this...
#5
04/20/2005 (6:06 am)
Now thats exactly the type of thing I'm looking for, thank you!