Setting an IP for UDPsocket

On a computer with VMplayer installed the computer has two(or more) IP addresses ie 10.0.0.63 and 192.168.81.1
The second one is a VMware network adapter.
if I run

  For i As Integer = 0 To System.NetworkInterfaceCount-1
    n=System.GetNetworkInterface(i)
    AddtoDebugFile("   MAC "+n.MACAddress+" IP  "+n.IPAddress+" Subnet mask "+n.SubnetMask)
  Next

this will get a list of all the network interfaces and using the above code returns

MAC 00:21:6A:93:50:3B IP 0.0.0.0 Subnet mask 0.0.0.0
MAC 00:21:6A:93:50:3A IP 10.0.0.63 Subnet mask 255.255.255.0
MAC 00:26:B9:13:B8:D4 IP 0.0.0.0 Subnet mask 0.0.0.0
MAC 00:50:56:C0:00:01 IP 192.168.81.1 Subnet mask 255.255.255.0
MAC 00:50:56:C0:00:08 IP 192.168.184.1 Subnet mask 255.255.255.0

I have a UDPsocket on the main window, and its IP is
192.168.184.1

So it seems to pick the last IP.
Is there anyway to force the UDPsocket to use one of the other IP addresses? in this case I want to use 10.0.0.63
Thanks
Hamish

You don’t need to. You specify the address when you Write to the socket.

Hi Tim, Thanks. I’m setting up a messaging system for small networks . If all the other computers are in the 10.0.0.(1-255) range and my computer is 192.168.81.1 I get problems with broadcast messages I think. If a 10.0.0.x computer sends out a broadcast to port 10125 all the other computers in the 10.0.0.x range will get it if they are listening,but the 192.168.81.1:10125 wont (may depend on the router)?)
Anyway, I think I have sorted it.

UDPSocket1.NetworkInterface=System.GetNetworkInterface(1)

this code will select the second address. So I can force the computer to use the IP I want.
Its sort of an edge case as most computers dont have VMware and this problem, but some do…

Thanks for your fast reply, I’m always amazed I get such fast replies on here.
Hamish