Exemplo n.º 1
0
        public NtpdServerCommands(NtpdServer parent, NtpdPersistentData dataIn)
        {
            main = parent;
            dataIn = dataIn;

            Thread commandsThread = new Thread(CommandListener);
            commandsThread.Start();
        }
Exemplo n.º 2
0
        public NtpdServer()
        {
            dataStorage = new NtpdPersistentData();
            cmdInterface = new NtpdServerCommands(this, dataStorage);
            sconv = new StreamConverter();
            tcpServer = new TcpListener(IPAddress.Any, 8888);
            Thread listenThread = new Thread(new ThreadStart(NewClient));
            listenThread.Start();

            // Currently this creates five fake clients to connect to the fledgeling server.

            for(int i = 0; i<5; i++)
            {
                TcpClient tcpC = new TcpClient();

                tcpC.Connect("localhost", 8888);

                Thread clientThread = new Thread(new ParameterizedThreadStart(ClientMain));
                clientThread.Start(tcpC);
            }
        }