Пример #1
0
 /// <summary>
 /// Constructs TcpOptions from uri and resources.
 /// </summary>
 /// <param name="uri"></param>
 /// <param name="resources"></param>
 public TcpOptions(URL uri, Resources resources)
 {
     autoFlush      = uri.GetBooleanTerm(AUTO_FLUSH, false);
     bufferSize     = CheckBufferSize(uri.GetIntegerTerm(BUFFER_SIZE, 0));
     keepAlive      = uri.GetBooleanTerm(KEEP_ALIVE, false);
     lingerTime     = CheckLingerTime(uri.GetIntegerTerm(LINGER_TIME, 30));
     noDelay        = uri.GetBooleanTerm(NO_DELAY, true);
     reconnectDelay = CheckReconnectDelay(uri.GetIntegerTerm(RECONNECT_DELAY, 0));
     trafficClass   = CheckTrafficClass(uri.GetIntegerTerm(TRAFFIC_CLASS, 0));
 }
Пример #2
0
 public UdpListener(URL uri, Resources resources)
     : this(TranslateHost(uri.Host),
            uri.Port != null ? uri.Port.Value : 0,
            (bool)uri.GetBooleanTerm(REUSE_PORT, false),
            0,
            (int)uri.GetIntegerTerm(QUEUE_SIZE, 15))
 {
     // nothing else.
 }
Пример #3
0
        public TlsConnection(Socket socket, URL uri, Resources resources)
            : base(uri, resources)
        {
            SetCertificateName(uri.GetTerm(CERT_NAME, "default"));
            SetAuthReqd(uri.GetBooleanTerm(AUTH_REQD, true));

            if (socket == null)
            {
                String host = uri.Host;
                if (host == null)
                {
                    throw new ArgumentNullException("host == null");
                }

                int?port = uri.Port;
                if (port == null)
                {
                    throw new ArgumentNullException("port == null");
                }

                if (port <= 0 || port >= 65536)
                {
                    throw new ArgumentOutOfRangeException("port <= 0 || port >= 65536");
                }

                this.socket = null;
                this.host   = host;
                this.port   = (int)port;
            }
            else
            {
                this.socket = socket;
                this.host   = null;
                this.port   = 0;
            }
        }
Пример #4
0
 public UdpConnection(URL uri)
     : this(uri.Host, uri.Port, uri.GetBooleanTerm(BROADCAST, false), 0)
 {
     // nothing else.
 }