Esempio n. 1
0
        public static void CreateServer()
        {
            currentPort = BaseUDPTests.GetPort();

            server = new UDPServer(32);
            server.Connect(port: currentPort);
            Console.WriteLine("Using port number: " + currentPort);
        }
Esempio n. 2
0
        public void TestBindUDPServer()
        {
            currentPort = BaseUDPTests.GetPort();
            string validHost      = "0.0.0.0";
            int    maxConnections = 32;

            server = new UDPServer(maxConnections);

            server.Connect(validHost, currentPort);

            Assert.IsNotNull(server.Me);
            Assert.IsNotNull(server.Me.IPEndPointHandle);

            var endpoint = server.Me.IPEndPointHandle;

            Assert.IsTrue(server.Client.Client.IsBound);
            Assert.AreEqual(endpoint.Address.ToString(), validHost);
            Assert.AreEqual(endpoint.Port, currentPort);

            server.Disconnect(false);

            Assert.IsFalse(server.IsConnected);
            Assert.IsFalse(server.IsBound);
        }