Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
        }