UdpClientTest.cs 691 B

12345678910111213141516171819202122232425262728293031
  1. // System.Net.Sockets.UdpClientTest.cs
  2. //
  3. // Authors:
  4. // Chris Bacon <[email protected]>
  5. //
  6. using System;
  7. using System.Net;
  8. using System.Net.Sockets;
  9. using NUnit.Framework;
  10. namespace MonoTests.System.Net.Sockets {
  11. [TestFixture]
  12. public class UdpClientTest {
  13. [Test]
  14. public void UdpClientBroadcastTest ()
  15. {
  16. bool exThrown = false;
  17. UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234));
  18. byte[] bytes = new byte[] {10, 11, 12, 13};
  19. try {
  20. client.Send (bytes, bytes.Length, new IPEndPoint (IPAddress.Broadcast, 1235));
  21. } catch (SocketException) {
  22. exThrown = true;
  23. }
  24. Assert.IsFalse(exThrown, "UdpClient Broadcast #1");
  25. }
  26. }
  27. }