public void disconnect() { if (socket == null) { Debug.LogError("socket is null"); return; } socket.disconnect(); socket = null; }
public void connect() { if (socket != null) { Debug.LogError("socket is not closed,try close"); socket.disconnect(); } Debug.Log("start connect ip:" + ip + " port:" + port); socket = new NetManagerSocket(); socket.ip = ip; socket.port = port; socket.connect(); sendBytes = 0; sendBytesTimeout = 0f; connectTimeout = 0f; }