public static void RegisterSocketClient(string host, int port, int index, bool islittleEnd) { if (clients == null) { return; } if (index < 0 || index >= clients.Length) { Debugger.LogError("connect index is invalid->" + index + "^" + clients.Length); return; } { NetClient netClient = clients[index]; if (netClient == null) { netClient = NetClient.GenNetClient(); clients[index] = netClient; } if (netClient.IsSocketOK()) { netClient.Close(); } clients[index].Init(host, port, index, islittleEnd); } }
public static void ReConnectSocketClient(int index) { if (clients == null) { return; } if (index < 0 || index >= clients.Length) { Debugger.LogError("connect index is invalid->" + index + "^" + clients.Length); return; } NetClient netClient = clients[index]; netClient.Close(); clients[index] = NetClient.CloneNetClient(netClient); ConnectSocketClient(index); }