public UdpServer(int receptionPort, int natPort, string host) { uint IOC_IN = 0x80000000; uint IOC_VENDOR = 0x18000000; uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12; Processors = new UdpProcessor[Environment.ProcessorCount]; for (int i = 0; i < Environment.ProcessorCount; i++) { Processors[i] = new UdpProcessor(this); } ReceptionUdp = new UdpClient(); ReceptionUdp.Client.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null); ReceptionUdp.Client.Bind(new IPEndPoint(IPAddress.Any, receptionPort)); ReceptionIP = CT.TCPServerEndPoint(host, receptionPort); NatUdp = new UdpClient(); NatUdp.Client.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null); NatUdp.Client.Bind(new IPEndPoint(IPAddress.Any, natPort)); NatIP = CT.TCPServerEndPoint(host, natPort); NatRecevie(); Receive(); }
public UToken(IPEndPoint remote, UdpProcessor processor, IUdpHandler udpHandler) : base(remote) { UdpHandler = udpHandler; UReciveProcessor = processor; Nat(); }