Esempio n. 1
0
        public void Send(byte[] data, IPv4.Address dest, Int32 destPort)
        {
            IPv4.Address   source = IPv4.Config.FindNetwork(dest);
            IPv4.UDPPacket packet = new IPv4.UDPPacket(source, dest, (UInt16)this.localPort, (UInt16)destPort, data);

            Sys.Console.WriteLine("Sending " + packet.ToString());
            IPv4.OutgoingBuffer.AddPacket(packet);
        }
Esempio n. 2
0
        internal void receiveData(IPv4.UDPPacket packet)
        {
            byte[]        data   = packet.UDP_Data;
            IPv4.EndPoint source = new IPv4.EndPoint(packet.SourceIP, packet.SourcePort);

            Sys.Console.WriteLine("Received " + data.Length + " bytes data from " + source.ToString());

            this.rxBuffer.Enqueue(new DataGram(data, source));
        }
Esempio n. 3
0
 internal static void UDPHandler(byte[] packetData)
 {
     UDPPacket udp_packet = new UDPPacket(packetData);
     Sys.Console.WriteLine("Received UDP packet from " + udp_packet.SourceIP.ToString() + ":" + udp_packet.SourcePort.ToString());
     UdpClient receiver = UdpClient.Client(udp_packet.DestinationPort);
     if (receiver != null)
     {
         Sys.Console.WriteLine("UDP Packet is for registered client");
         receiver.receiveData(udp_packet);
     //    DataReceived dlgt = udpClients[udp_packet.DestinationPort];
     //    if (dlgt != null)
     //    {
     //        dlgt(new IPv4EndPoint(udp_packet.SourceIP, udp_packet.SourcePort), udp_packet.UDP_Data);
     //    }
     }
 }
Esempio n. 4
0
        public void Send(byte[] data, IPv4.Address dest, Int32 destPort)
        {
            IPv4.Address source = IPv4.Config.FindNetwork(dest);
            IPv4.UDPPacket packet = new IPv4.UDPPacket(source, dest, (UInt16)this.localPort, (UInt16)destPort, data);

            Sys.Console.WriteLine("Sending " + packet.ToString());
            IPv4.OutgoingBuffer.AddPacket(packet);
        }