Exemplo n.º 1
0
        private void Admin()
        {
            string username = "";
            Socket client   = null;

            try
            {
                client = server.Accept(ref username, ref clients, ref MemberBox);
            }
            catch
            {
                return;
            }
            Invoke((Action) delegate { StatLabel.Text = "Connection Established"; });
            Thread StreamThread = new Thread(new ThreadStart(() => Stream(client, 60)));

            StreamThread.Start();
            Thread ReceiveThread = new Thread(new ThreadStart(() => Receive(client)));

            ReceiveThread.Start();
        }
Exemplo n.º 2
0
        public void AcceptUser()
        {
            Socket clientSocket;

            while (true)
            {
                string user = "";
                try
                {
                    clientSocket = server.Accept(ref user, ref connectedClient, ref Members);
                }
                catch
                {
                    break;
                }
                connectedClient.Add(clientSocket);
                Thread clientThread = new Thread(new ThreadStart(() =>
                                                                 User(clientSocket, user)));
                clientThread.Start();
            }
        }