Exemplo n.º 1
0
        public UdpConnection(string host, int?port, bool enableBroadcast, int delay)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host is missing");
            }
            else if (host == "255.255.255.255")
            {
                enableBroadcast = true;
            }

            if (port == null)
            {
                throw new ArgumentNullException("port");
            }
            else if (port <= 0 || port >= 65536)
            {
                throw new ArgumentException("port <= 0 || port >= 65536");
            }

            this.host            = host;
            this.port            = (int)port;
            this.enableBroadcast = enableBroadcast;
            this.delay           = delay;

            listener = null;
        }
Exemplo n.º 2
0
        public UdpConnection(IPEndPoint remoteIpEndPoint, UdpListener listener)
        {
            this.remoteIpEndPoint = remoteIpEndPoint;
            this.listener         = listener;

            readQueue = listener.allocReadQueue(remoteIpEndPoint);
        }