Bind() public method

public Bind ( int port, bool reuseAddress ) : bool
port int
reuseAddress bool
return bool
Esempio n. 1
0
 public NtpSyncModule(string ntpServer)
 {
     _ntpEndPoint = new NetEndPoint(ntpServer, 123);
     _socket      = new NetSocket(OnMessageReceived);
     _socket.Bind(0, false);
     SyncedTime = null;
 }
        /// <summary>
        /// Start logic thread and listening on selected port
        /// </summary>
        /// <param name="port">port to listen</param>
        public bool Start(int port)
        {
            if (IsRunning)
            {
                return(false);
            }

            _netEventsQueue.Clear();
            if (!_socket.Bind(port, ReuseAddress))
            {
                return(false);
            }

            _logicThread.Start();
            return(true);
        }