private void ConnectToServer() { //Don't heartbeat while connecting heartbeatTimer.Stop(); try { State = new State { ServerSettings = new ServerSettings { Password = "", ServerName = "" } }; client = new Sockets.Client(endpoint, port); client.PacketReceived += Client_PacketReceived; client.ServerConnected += Client_ServerConnected; client.ServerFailedToConnect += Client_ServerFailedToConnect; client.ServerDisconnected += Client_ServerDisconnected; client.Start(); } catch (Exception e) { Logger.Debug("Failed to connect to server. Retrying..."); Logger.Debug(e.ToString()); } }
private void ConnectToServer() { //Don't heartbeat while connecting heartbeatTimer.Stop(); try { State = new State(); State.Players = new Player[0]; State.Coordinators = new MatchCoordinator[0]; State.Matches = new Match[0]; client = new Sockets.Client(endpoint, port); client.PacketRecieved += Client_PacketRecieved; client.ServerConnected += Client_ServerConnected; client.ServerFailedToConnect += Client_ServerFailedToConnect; client.ServerDisconnected += Client_ServerDisconnected; client.Start(); } catch (Exception e) { Logger.Debug("Failed to connect to server. Retrying..."); Logger.Debug(e.ToString()); } }