Beispiel #1
0
        private void InitConnect()
        {
            for (int i = 0; i < MaxConnections; i++)
            {
                var packet = new Packets.ClientPacket();
                packet.Options = Options;
                AsyncTcpClient client;
                if (mSslServerName == null)
                {
                    client = BeetleX.SocketFactory.CreateClient <BeetleX.Clients.AsyncTcpClient>(

                        packet, Host, Port);
                }
                else
                {
                    client = BeetleX.SocketFactory.CreateSslClient <BeetleX.Clients.AsyncTcpClient>(

                        packet, Host, Port, mSslServerName);
                }
                client.PacketReceive = OnPacketCompleted;
                client.ClientError   = OnError;
                bool isnew;
                client.Connect(out isnew);
                mClients.Add(new TcpClientItem(client, this));
            }
        }
Beispiel #2
0
        public void Connect()
        {
            for (int i = 0; i < MaxConnections; i++)
            {
                var packet = new Packets.ClientPacket();
                packet.Options = Options;
                AsyncTcpClient client;
                if (mSslServerName == null)
                {
                    client = BeetleX.SocketFactory.CreateClient <BeetleX.Clients.AsyncTcpClient>(

                        packet, Host, Port);
                }
                else
                {
                    client = BeetleX.SocketFactory.CreateSslClient <BeetleX.Clients.AsyncTcpClient>(

                        packet, Host, Port, mSslServerName);
                }
                client.PacketReceive = OnPacketCompleted;
                client.ClientError   = (c, e) =>
                {
                    NetError?.Invoke(c, e);
                };
                mClients.Add(client);
            }
        }