Hi, this question has been asked before, but I can't find the solution I'm looking for.
I'm creating an app to upload text messages to a server. I'd like to add the IP address of the user (encrypted) to the header of the message, so action can be taken when the user does something inappropriate.
Many people are behind a router and Winsock1.LocalIP will then show the LAN IP address, like 192.168.1.100 and not the WAN address.
Then I thought, I might get the IP address when connecting to the server first, but then Winsock1.LocalIP returns 127.0.0.1 (local host).Code:Private Sub Command1_Click() MsgBox Winsock1.LocalIP End Sub
The only solution I know, is to connect to whatismyip.com or a similar site and read the IP address. Generally it works fine, but it might seem a little bit suspicious when people have a firewall installed and a message pops up that the app is trying to connect to whatismyip.com.Code:Private Sub Command1_Click() Winsock1.Connect "123.123.123.123", 80 End Sub Private Sub Winsock1_Connect() MsgBox Winsock1.LocalIP End Sub
Is there any way to get the WAN address without getting it from an external source.




Reply With Quote