Ejemplo n.º 1
0
            public User(TcpClientWrapper clientSocket, bool isConsole)
            {
                socket = clientSocket;
                _isConsole = isConsole;

                packet = new Packet();
                packet.skipHeaders = isConsole;
                packet.DataSent += new Packet.SendDataDelegate(packet_SendData);
                bufferer = new PacketBufferer(SendDataFinal, null, Config.SendBufferInterval);

                Flags = UserFlags.Normal;
            }
Ejemplo n.º 2
0
        protected void SetupSocket()
        {
            socket = new TcpClientWrapper(20);
            socket.ConnectionEstablished += new TcpClientWrapper.ConnectionEstablishedDelegate(socket_ConnectionEstablished);
            socket.ConnectionRefused += new TcpClientWrapper.ConnectionRefusedDelegate(socket_ConnectionRefused);
            socket.Disconnected += new TcpClientWrapper.DisconnectedDelegate(socket_Disconnected);
            socket.DataRead += new TcpClientWrapper.DataReadDelegate(socket_DataRead);

            packet = new Packet();
            packet.DataSent += new Packet.SendDataDelegate(packet_DataSent);
            bufferer = new PacketBufferer(SendDataFinal, null, 100);
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            lock (sockets)
            {
                for (int i = 0; i < 10; i++)
                {
                    TcpClientWrapper sock = new TcpClientWrapper(20);
                    sock.ConnectionEstablished += new TcpClientWrapper.ConnectionEstablishedDelegate(sock_ConnectionEstablished);
                    sock.DataRead += new TcpClientWrapper.DataReadDelegate(sock_DataRead);

                    Packet pack = new Packet();
                    pack.DataSent += new Packet.SendDataDelegate(pack_DataSent);

                    PacketBufferer bufferer = new PacketBufferer(SendDataFinal, sock, 100);

                    sockets.Add(pack, sock);
                    packets.Add(sock, pack);
                    buffers.Add(sock, bufferer);

                    sock.AsyncConnect("127.0.0.1", 4800);
                }
            }
        }
Ejemplo n.º 4
0
 private void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             socket = null;
             packet = null;
             bufferer = null;
             Channel = null;
         }
         disposed = true;
     }
 }