Example #1
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);
            }
        }
Example #2
0
 private void RaiseOtherException(AsyncSocketState state)
 {
     if (NetError != null)
     {
         NetError.Invoke(this, new AsyncSocketEventArgs(state));
     }
 }
Example #3
0
 private void OnError(IClient client, ClientErrorArgs e)
 {
     try
     {
         NetError.Invoke(client, e);
     }
     catch
     {
     }
 }
Example #4
0
 /// <summary>
 /// 触发网络错误事件
 /// </summary>
 /// <param name="state"></param>
 private void RaiseNetError(AsyncUDPState state, Exception exception)
 {
     NetError?.Invoke(this, new ScadaUDPEventArgs(exception, state));
 }
Example #5
0
 /// <summary>
 /// 触发网络错误事件
 /// </summary>
 /// <param name="state"></param>
 private void RaiseNetError(AsyncSocketState state)
 {
     NetError?.Invoke(this, new AsyncSocketEventArgs(state));
 }