title: udpclient receive and broadcast problem
body: <p>I have this code that keeps giving me two problems.</p>
  
  <p>first</p>
  
  <blockquote>
    <p>The requested address is not valid in its context</p>
  </blockquote>
  
  <p>second , it receives broadcast it sends, i dont want this. I want only the listeneing server app to receive the broadcast</p>
  
  <p>the sending code    </p>
  
  <pre><code>Dim sendMessage As New structMessage
          sendMessage.Command = Command.IP
          Dim byteData As Byte() = sendMessage.ToByte()
          'Using UDP sockets
  
          epServer = New IPEndPoint(IPAddress.Any, iCurrUDPPort)
  
          'sckClientUDP.EnableBroadcast = True
          sckClientUDP.EnableBroadcast = True
          sckClientUDP.BeginSend(byteData, byteData.Length, _
                                 CType(epServer, Net.IPEndPoint), _
                                  New AsyncCallback(AddressOf sckClientUDP_DataArrival), _
                                  Nothing)
  
  
          '## if server not found , increment port
          If iCurrUDPPort = iToPort Then
              iCurrUDPPort = iFromPort
          Else
              iCurrUDPPort = iCurrUDPPort + 1
          End If
  </code></pre>
  
  <p>The receiving code</p>
  
  <pre><code>    Private Sub sckClientUDP_DataArrival(ByVal ar As IAsyncResult)
          Try
              Dim remoteEP As EndPoint = Nothing
              sckClientUDP.EndReceive(ar, CType(remoteEP, IPEndPoint))
              'Convert the bytes received into an object of type Data
              Dim recvMessage As New structMessage(byteData)
              'Accordingly process the message received
              Select Case recvMessage.Command
                  Case Command.IP
                      ServerIP = recvMessage.IP
                      ServerPort = recvMessage.Port
                      ' try connect here (TCP)
              End Select
  
              byteData = New Byte(1023) {}
  
              'Start listening to receive more data from the user
              sckClientUDP.BeginReceive(New AsyncCallback(AddressOf sckClientUDP_DataArrival), Nothing)
          Catch generatedExceptionName As ObjectDisposedException
          Catch ex As Exception
              Debug.Print(ex.Message)
          End Try
  end sub
  </code></pre>
  
  <p>How do i fix this problems?</p>