/// <summary> /// Dispose socket /// </summary> public void Disconnect() { if (client != null) { client.Close(); } status = L4D2ServerAgentStatus.Offline; client = null; StopAllCoroutines(); }
/// <summary> /// Create new socket /// </summary> public void Connect() { if (client != null) { client.Close(); StopAllCoroutines(); } status = L4D2ServerAgentStatus.WaitForChallengeNumber; lastRespondTime = Time.time; client = new ValveServerQueryClient(ip, port); client.MessageHandler += OnReceiveMessage; StartCoroutine(ChallengeNumberAcquireRoutine()); }