udp and ip

BlitzMax Forums/BlitzMax Beginners Area/udp and ip

Polan(Posted 2009) [#1]
Is there any way to get ip of client, who have router?
socketlocalip say 192.168.xxx.xxx for router user and I need to get ip which I can use to connect from other pc that is not connected to that router.
Edit:
Problem fixed with tcp. connect, get ip, dc :)


_Skully(Posted 2009) [#2]
OK...

The computer that is outside the router needs to address the one behind the router using the router's IP address... then you will need to either have that computer (behind the router) in the DMZ or port forwarded (router configuration).


Czar Flavius(Posted 2009) [#3]
Port-forwarding is the safest method. If you don't know how to, you can usually access the router settings by typing its IP address into the address bar of your browser. For example 192.168.0.1

To find the external IP address, try something like www.whatismyip.com


xlsior(Posted 2009) [#4]
Here's some Blitzmax code to get the external router IP:

http://www.blitzbasic.com/codearcs/codearcs.php?code=2429#comments


Czar Flavius(Posted 2009) [#5]
Although that code may be useful, I think it's important to point out that all it does is ask an external site (such as www.whatismyip.com - the first example!) for the IP address, and therefore relies upon that site working and being up. You should bear in mind that if the website goes down the code will no longer work.


Polan(Posted 2009) [#6]
there is no function OpenTCPStream and closetcpstream in blitzmax...


ImaginaryHuman(Posted 2009) [#7]
Maybe you could have several sites that you use to get the ip address when one or more isn't available, as backups?


Czar Flavius(Posted 2009) [#8]
Hm the sample code posted above is for BlitzBasic and not BlitzMax.