public Protocol(PomeloClient pc, System.Net.Sockets.Socket socket)
 {
     this.pc = pc;
     this.transporter = new Transporter (socket, this.processMessage);
     this.handshake = new HandShakeService(this);
     this.state = ProtocolState.start;
 }
Exemple #2
0
 public Protocol(PomeloClient pc, Socket socket)
 {
     this.pc          = pc;
     this.transporter = new Transporter(socket, new Action <byte[]>(this.processMessage));
     this.handshake   = new HandShakeService(this);
     this.state       = ProtocolState.start;
 }
        public static void Run()
        {
            int num = 10;
            int limit = 1000;

            Transporter tc = new Transporter(null, process);

            List<byte[]> list;

            byte[] buffer = generateBuffers(num, out list);

            int offset = 0;
            while(offset < buffer.Length){
                int length = 1;
                length = (offset + length)> buffer.Length? buffer.Length - offset: length;

                tc.processBytes(buffer, offset, offset + length);
                offset += length;
            }

            if(!check (list)){
                Console.WriteLine("Transport test failed!");
            }else{
                Console.WriteLine("Transport test success!");
            }
        }
 public Protocol(PomeloClient pc, System.Net.Sockets.Socket socket)
 {
     this.pc          = pc;
     this.transporter = new Transporter(socket, this.ProcessMessage);
     this.transporter.onDisconnect = this.OnDisconnect;
     this.handshake = new HandShakeService(this);
     this.state     = ProtocolState.start;
 }
Exemple #5
0
        public Protocol(Connection pc, System.Net.Sockets.Socket socket)
        {
            this._pomeloClient             = pc;
            this._transporter              = new Transporter(socket, this.processMessage);
            this._transporter.onDisconnect = onDisconnect;

            this._handshake = new HandShakeService(this);
            this._state     = ProtocolState.start;
        }