예제 #1
0
        /// <summary>
        /// Starts the listening process.
        /// </summary>
        public void Start()
        {
            try
            {
                _mainSocket = new EventSocket(SocketType.Stream, ProtocolType.Tcp);

                int backlog = 10;

                // Set the socket to listen to the local endpoint.
                _mainSocket.Bind(_endpoint);
                _mainSocket.Listen(backlog);
                OnStarted(backlog, _endpoint);
                _worker.RunWorkerAsync();
            }
            catch (SocketException ex)
            {
                OnError(ex);
            }
        }