Exemplo n.º 1
0
        public void UseDualModeOnInterNetworkV6()
        {
            // Act
            client = UdpClientFactory.Create(0, AddressFamily.InterNetworkV6);

            // Assert
            client.Client.DualMode.ShouldBeTrue();
        }
Exemplo n.º 2
0
        public async void SendPayload(string address, AddressFamily family)
        {
            // Arrange
            client = UdpClientFactory.Create(0, family);

            var ipAddress = IPAddress.Parse(address);

            using (var server = new UdpClient(0, ipAddress.AddressFamily))
            {
                var receiveTask = server.ReceiveAsync();

                // Act
                await client.SendAsync(
                    PayloadAsBytes,
                    PayloadAsBytes.Length,
                    new IPEndPoint(ipAddress, ((IPEndPoint)server.Client.LocalEndPoint).Port));

                // Assert
                var receivedData = (await receiveTask).Buffer;
                Encoding.UTF8.GetString(receivedData).ShouldBe(Payload);
            }
        }
 public UdpClientFactoryShould()
 {
     client = UdpClientFactory.Create(0, true);
 }