public void StartClient(TcpClient inClientSocket, string clineNo)
 {
     this._clientSocket = inClientSocket;
     this.clNo = clineNo;
     var ctThreadWriter = new Thread(RunSocketReader);
     var ctThreadReader = new Thread(RunSocketWriter);
     ctThreadWriter.Start();
     ctThreadReader.Start();
     _registryWatcher = new RegistryWatcher(KeyValueChanged);
     _registryWatcher.InitializeRegistryWatcher();
     SetInitialChannel();
 }
Exemple #2
0
        static void Main(string[] args)
        {
            var ssid = GetSSIDName();
            var serverSocket = new TcpListener(8675);
            EndPoint ep = serverSocket.LocalEndpoint;
            var clientSocket = default(TcpClient);
            int counter = 0;
            var watcher = new RegistryWatcher(KeyValueChanged);
            watcher.InitializeRegistryWatcher();

            serverSocket.Start();
            Console.WriteLine(" >> " + "Server Started");

            counter = 0;
            while (true)
            {
                counter += 1;
                clientSocket = serverSocket.AcceptTcpClient();
                Console.WriteLine(" >> " + "Client No:" + Convert.ToString(counter) + " started!");
                ClientHandler client = new ClientHandler();
                client.StartClient(clientSocket, Convert.ToString(counter));
                s_clientdictionary.Add(counter, client);
            }

            clientSocket.Close();
            serverSocket.Stop();
            Console.WriteLine(" >> " + "exit");
            Console.ReadLine();
        }