Esempio n. 1
0
    public void TestSimpleConnections()
    {
        // Starting the Server
        var server = new ServerTcpHandler();

        server.StartListening(8888);

        int numberOfClients = 3;

        // Connecting a client to the server
        for (var x = 0; x < numberOfClients; x++)
        {
            var client = new ConnectedClientTcpHandler(new TcpClient("localhost", 8888));
        }

        // Wait for all the connections
        Thread.Sleep(1000);

        Assert.AreEqual(numberOfClients, ServerTcpHandler.ConnectedSockets());
    }
Esempio n. 2
0
 public void StartListeningForPackets()
 {
     TcpHandler = new ServerTcpHandler();
     TcpHandler.StartListening(PORT);
     _running = true;
 }