How do I find another computers Ip adress with

Blitz3D Forums/Blitz3D Beginners Area/How do I find another computers Ip adress with

WERDNA(Posted 2008) [#1]
How do I find another computers Ip adress so I can connect to it
using OpenTcpStream.
(Like the host of a game for example)

And if anyone can find me some really simple Multiplayer online games
in the archives, that would certainly be helpful.

Because I'm trying to make an online game, but am totally clueless.

Also if your the host of a game, would you use the hostgame command
to set it up, or simply use createtcpserver?
Or both?

If someone could help out with this, I would certainly appreciate it.

The Connectable WERDNA(Simply Connect Port A, To Port B, And
Then Twist Port C, To Port E, And Connect The Riveters To Port T,
While Holding Down Port G. WARINING, THIS PRODUCT IS NOT FOR
CHILDREN UNDER THE AGE OF 21, IF YOU EXPERIENCE MIGRAINES
OR HEADACHES WHILE USING THIS PRODUCT, PLEASE CONSULT
YOUR DOCTOR)


markcw(Posted 2008) [#2]
Well what you usually do is have a server handle setting up connections and other 'global' things like high scores. This means you need server-side scripting like php or perl.

The theory would be something like this:
user opens game, clicks net game option
game gets users IP and connects to server
server lists all current games and options
user clicks to host or join a net game
if user hosts a net game then game sends IP to server for others
if user joins a net game then game just gets IP of host
when user closes game or logs out, game tells server to remove user from list

A simpler way is to use email and just send your friend your IP which the game could get for you.


*(Posted 2008) [#3]
Use GNet :D


PowerPC603(Posted 2008) [#4]
If you know the name of the server to which you want to connect, you can use this function:
Function GetIP$(ServerName$)
	Local n, address$

	; Set hostname to be able to retreive IP
	n = CountHostIPs(ServerName$)
	; n now contains the total number of IP's on the specified host

	; Obtain the internal id for the IP address
	ip = HostIP(1)

	; Convert it to human readable IP address
	address$ = DottedIP$(ip)
	Return address$
End Function


I wrote this function when I created a launcher for the game Lineage2 in order to connect to my friend's server, it needed to rewrite my hosts file everytime I wanted to connect to his computer.

Use it like this:
Server$ = Input$("Enter the servername: ")

Print GetIP$(Server$)
WaitKey()
End


When you run this, try to enter "www.google.com".


WERDNA(Posted 2008) [#5]
Ok, thanks guys.

I'll probably post some questions shortly, but this will do for now.

Thanks Again,

The New And Improved Connectable WERDNA
Http://hosted.filefront.com/werdnaworld