コード例 #1
0
        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);
        }
コード例 #2
0
        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
            });
        }