I've done LAN Broadcasting, so my client program can find my server program in LAN.
The idea is - client is broadcasting, server answer and says his own ip address (192.168.79.2)
Server is getting his own local ip by connecting to himself thru UDP and receiving IP Address from it.
Code: Select all
FakeConnection = OpenNetworkConnection(Hostname(), UDPPort, #PB_Network_UDP)
If FakeConnection
LocalIP = GetClientIP(FakeConnection)
CloseNetworkConnection(FakeConnection)
EndIf
;IPString(LocalIP)
It works alright on my own pc, if I run server and client, but when I run client on another PC, I get answer on broadcasting from server - server ip (192.168.79.2), but I cannot connect to it. Simply cant create a connection.
Checking IPs in cmd via ipconfig command I realized, that these two ips 192.168.72.2 (server PC) and 192.168.56.1 (client PC) are VirtualBox-HostOnly Network Adapter IPs.
Tho true Ethernet IPv4 addresses are 192.168.1.101 and 192.168.1.107 and using them I can connect successfully.
So, how can I get server real local ip (by real I mean not VirtualBox ones, but nice 192.168.1.101 ones), so it will tell client its ip and client will connect using it and not VirtualBox IPs.
P.s. Im not using VirtualBox for testing. There are only network adapters, that probably screw things up