Пример #1
0
        protected override void OnPacketReceived(byte[] bytes, IPEndPoint receivedFrom)
        {
            var datagram = new DatagramPacket(bytes, bytes.Length, receivedFrom);
            var packet = new NfsPacket(datagram);
            var e = new UdpPacketReceivedEventArgs(packet, receivedFrom);

            //Console.WriteLine("\nPacket Received : EndPoint: " + _listener.Client.Client.LocalEndPoint.ToString());

            uint xId = packet.XID = packet.GetUInt();
            uint type = packet.GetUInt();

            if (type == (int)RpcSignalType.Call) {
                Call(ref packet, xId);
            }
            else if (type == (int)RpcSignalType.Reply) {
                Reply(ref packet, xId);
            }

            //RaisePacketReceived(e);

            if (packet.ProgramID == this.ProgramID) {
                //Console.WriteLine("Found program: " + packet.ProgramID);
                Process(packet, receivedFrom);
            }
        }
Пример #2
0
        protected virtual void OnPacketReceived(byte[] bytes, IPEndPoint receivedFrom)
        {
            var datagram = new DatagramPacket(bytes, bytes.Length, receivedFrom);
            var packet   = new UdpPacket(datagram);
            var e        = new UdpPacketReceivedEventArgs(packet, receivedFrom);

            RaisePacketReceived(e);
        }
Пример #3
0
        public UdpPacket(DatagramPacket datagram)
        {
            _data = datagram.Bytes;
            _length = datagram.Length;
            _position = 0;
            _source = datagram.ServerEndPoint == null ? null : datagram.ServerEndPoint.Address;
            _port = datagram.ServerEndPoint == null ? 0 : datagram.ServerEndPoint.Port;

            //Console.Write("source: " + _source);
            //Console.Write(" port: " + _port);
            //Console.Write(" data length: " + _length + "\n");
        }
Пример #4
0
        public UdpPacket(DatagramPacket datagram)
        {
            _data     = datagram.Bytes;
            _length   = datagram.Length;
            _position = 0;
            _source   = datagram.ServerEndPoint == null ? null : datagram.ServerEndPoint.Address;
            _port     = datagram.ServerEndPoint == null ? 0 : datagram.ServerEndPoint.Port;

            //Console.Write("source: " + _source);
            //Console.Write(" port: " + _port);
            //Console.Write(" data length: " + _length + "\n");
        }
Пример #5
0
 public NfsPacket(DatagramPacket datagram)
     : base(datagram)
 {
 }