Question about UdpClient sample
' This constructor arbitrarily assigns the local port number.
Dim udpClient As New UdpClient()
Try
udpClient.Connect("www.contoso.com", 11000)
' Sends a message to the host to which you have connected.
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody there?")
udpClient.Send(sendBytes, sendBytes.Length)
' Sends message to a different host using optional hostname and port
parameters.
Dim udpClientB As New UdpClient()
udpClientB.Send(sendBytes, sendBytes.Length, "AlternateHostMachineName",
11000)
'Blocks until a message returns on this socket from a remote host.
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
' Blocks until a message returns on this socket from a remote host.
Dim receiveBytes As [Byte]() = udpClient.Receive(RemoteIpEndPoint)
Dim returnData As String = Encoding.ASCII.GetString(receiveBytes)
I was wondering what is the reason that when we need to receive
a message from a remote host we do IPAddress.Any,0
i.e why do we wait at port 0 rather than 11000, which is where
we sent to?