Пример #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Server" /> class.
        /// </summary>
        /// <param name="core">
        ///     進入點物件
        /// </param>
        /// <param name="port">
        ///     監聽的埠
        /// </param>
        public Server(ICore core, int port)
        {
            _ThreadCoreHandler = new ThreadCoreHandler(core);
            _ThreadSocketHandler = new ThreadSocketHandler(port, _ThreadCoreHandler);

            _WaitSocket = new AutoResetEvent(false);
        }
Пример #2
0
        public ThreadSocketHandler(int port, ThreadCoreHandler core_handler)
        {
            _CoreHandler = core_handler;
            _Port = port;

            _Sockets = new Queue<Socket>();

            _Peers = new PeerSet();

            _Spin = new PowerRegulator();
            _AutoPowerRegulator = new AutoPowerRegulator(_Spin);
        }