public UdpProxyReactor(INode listener, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE) : base(listener, encoder, decoder, allocator, bufferSize) { UdpNodeConfig nodeConfig = listener.nodeConfig as UdpNodeConfig; LocalEndPoint = new IPEndPoint(IPAddress.Parse(nodeConfig.LocalAddress), nodeConfig.LocalPort); RemoteEndPoint = new IPEndPoint(IPAddress.Any, nodeConfig.LocalPort); ListenerSocket = new Socket(LocalEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp); }
public static INode ToNode(this IPEndPoint endPoint, ReactorType transportType) { NodeConfig nodeConfig = new UdpNodeConfig() { LocalAddress = endPoint.Address.ToString(), LocalPort = endPoint.Port }; return(new Node { nodeConfig = nodeConfig, reactorType = transportType }); }