Exemple #1
0
        public static ServerTheadingManage getInstance()
        {
            if (_instance == null)
            {
                _instance = new ServerTheadingManage();
            }

            return(_instance);
        }
        public static ServerTheadingManage getInstance()
        {
            if (_instance == null)
            {
                _instance = new ServerTheadingManage();
            }

            return _instance;
        }
Exemple #3
0
        public MyClient(TcpClient socketClient, Server currentForm)
        {
            setCurrentForm(currentForm);
            id              = NEXT_ID_NUMBER;
            NEXT_ID_NUMBER += 1;
            _socket         = socketClient;
            isRunning       = true;

            _threadManage = ServerTheadingManage.getInstance();
            _idThread     = _threadManage.addNewWork(listenServer);
            _threadManage.startInstance(_idThread);

            _mysendFactory         = new MySendFactory(_socket);
            _listQuestionAnswereds = new List <string>();
        }
Exemple #4
0
        private void Server_Load(object sender, EventArgs e)
        {
            serverSocket = new TcpListener(8888);
            serverSocket.Start();

            _threadmanage = ServerTheadingManage.getInstance();

            _myClientManage = MyClientManage.getInstance();
            _myClientManage.setCurrentForm(this);

            _myListenAccept = SvListenAcceptClient.getInstance(serverSocket);
            _sthreadAcceptClient = new Thread(_myListenAccept.task);
            _myListenAccept.start();
            _myListenAccept.setForm(this);
            _sthreadAcceptClient.Start();

            tbPassword.Text = "";

            cleanGroupQuestion();
            lbServerIP.Text = GetLocalIPAddress();
            this.addToReceiverText(">> Server đã khởi động xong.");
        }