IP Address?

Advanced game related topics
GBeebe
Enthusiast
Enthusiast
Posts: 263
Joined: Sat Oct 09, 2004 6:52 pm
Location: Franklin, PA - USA
Contact:

IP Address?

Post by GBeebe »

Is there a way (In PB native code) to determin the IP address on a server?

Not everyone knows how to look for thier IP address in windows, And I certainly don't know how to find it in linux. So I thought that it would be easier to display it to the player who is hosting a game so that he/she can tell everyone else on a LAN...

Or better yet, has anyone figured out how to search a LAN for existing game servers (like every other LAN game does)?
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Code: Select all

InitNetwork() : ExamineIPAddresses()
IPAddress.s = IPString(NextIPAddress())
Debug IPAddress
--Kale

Image
plouf
Enthusiast
Enthusiast
Posts: 281
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Post by plouf »

just tell them to look at http://www.whatismyip.com/

or make a simple parser to retriecve data from this page
so you can retrieve ip from router if the are behind NAT
Christos
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Games on a LAN uses UDP broadcast to find servers.....
jrw
User
User
Posts: 24
Joined: Fri Jul 18, 2003 6:25 pm

Post by jrw »

plouf wrote:just tell them to look at http://www.whatismyip.com/

or make a simple parser to retriecve data from this page
so you can retrieve ip from router if the are behind NAT
It's amazing that someone has made a website to display someone's real ip address, yet his code is actually incorrect :lol:

For a large majority of people his script will show the ip address of the proxy server they are using. He should display the HTTP_X_FORWARDED_FOR var and not REMOTE_ADDR

Something like http://www.auditmypc.com/myinfo.asp will display your real ip address even if you're using a proxy server.
Post Reply