コード例 #1
0
ファイル: Socket.cs プロジェクト: jamesaxl/reactor
        public Socket(System.Net.IPAddress address, int port)
        {
            this.OnConnect += ()    => { };

            this.OnData    += data  => { };

            this.OnError   += error => { };

            this.OnEnd     += ()    => { };

            this.sending    = false;

            this.endpoint   = new System.Net.IPEndPoint(address, port);

            this.socket     = Reactor.Udp.Socket.Create();

            this.socket.Bind(System.Net.IPAddress.Any, 0);

            this.socket.OnMessage += (remote, data) => {

                if (remote.ToString() == this.endpoint.ToString()) {

                    this.Receive(data);
                }
            };

            var syn = new Syn(Random.Get());

            this.socket.Send(this.endpoint, syn.Serialize());
        }
コード例 #2
0
ファイル: Socket.cs プロジェクト: jamesaxl/reactor
        internal void ReceiveSyn(Syn          syn)
        {
            var synack = new SynAck(Random.Get(), syn.SequenceNumber + 1);

            this.socket.Send(this.endpoint, synack.Serialize());
        }