title: Is there a dot42 equivalent to System.Net.Sockets.UdpClient?
body: <p>First off, I am new to Android and dot42. I have built a UDP Listener class, which is working fine in a Windows application. I am using the System.Net.Sockets.UdpClient class.</p>
  
  <p>Now, I have tried to use my UDP Listener class in a dot42 project, but I get the error message </p>
  
  <blockquote>
    <p>Type System.Net.Sockets.UdpClient not found. </p>
  </blockquote>
  
  <p>I guess, this class is not available within dot42?</p>
  
  <p>Is there a way I can use the same code below (or only a few modifications) for Android apps?</p>
  
  <pre><code>using System;
  using System.Net;
  using System.Net.Sockets;
  
  namespace FSInterface
  {
      public class UDPReceiver
      {
          private UdpClient _udpRx;
          private IPEndPoint ep;
          private int _port;
  
          public delegate void BytesReceive(byte[] buffer);
          public event BytesReceive OnBytesReceive;
  
          public UDPReceiver(int port)
          {
              _port = port;
              _udpRx = new UdpClient();
              _udpRx.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
              _udpRx.ExclusiveAddressUse = false;
              ep = new IPEndPoint(IPAddress.Any, _port);
              _udpRx.Client.Bind(ep);
              _udpRx.BeginReceive(new AsyncCallback(ReceiveCallback), null);
          }
  
          private void ReceiveCallback(IAsyncResult ar)
          {
              _udpRx.BeginReceive(new AsyncCallback(ReceiveCallback), null);
  
              byte[] buffer = _udpRx.EndReceive(ar, ref ep);
  
              if (OnBytesReceive != null)
              {
                  OnBytesReceive(buffer);
              }
          }
      }
  }
  </code></pre>