Interesting, but it doesn't answer my question. If the UdpClient ctor
picks a free port number, how can I find out which port number?
Bill
Miro wrote:
One more thing Bill,
Dont forget to close the Receiving UPD client before you close the
hread. - i dont think the example link shows it.
Otherwise what happens is the Application still remains running for a
while
even after
you close the form.
So what I did is on the "close" of the form I added this code.
'Close the Socket - which should force the close of the open
thread listener
'Without this the thread could still remain open
receivingUdpClient.Close()
'Abort the thread - This doesnt always work alone - need to
close socket as well.
ThreadReceive.Abort()
If you want my mini snippet of code i created to send and recieve
strings
between an exe, lemi know.
Ill just paste it all here.
Miro
Bill,
This is a great example:
http://www.codeproject.com/vb/net/UDP_Send_Receive.asp
I used it...but basically you do this:
'in my case i made it a public var
Public SocketNO As Integer = 1234 ' where 1234 is your socket no u
want
Public RemoteIpEndPoint As New _
System.Net.IPEndPoint(System.Net.IPAddress.Any, SocketNO)
'then the sub i had as a receiver
Public Sub Receive_Application_Parameters()
Dim receiveBytes As [Byte]() =
receivingUdpClient.Receive(RemoteIpEndPoint)
... more code
End Sub
If I do this:
Dim receiver As New UdpClient()
Then the documentation says the system will pick a port. How can I
extract the chosen port number from receiver?
Bill