convertions network b3d-bmax

BlitzMax Forums/BlitzMax Programming/convertions network b3d-bmax

mongia2(Posted 2006) [#1]
n = CountHostIPs("")
ip = HostIP(1)

ipaddress$ = DottedIP$(ip)

Print "Dotted IP Test"
Print "=============="
Print ""
Print "Internal Host IP ID:" + ip
Print "Dotted IP Address:" + ipaddress$
Print ""
Print "Press any key to continue"

WaitKey()



thanks for help
mongia


tonyg(Posted 2006) [#2]
Local ip_array:Int[]=HostIps("localhost")
ip:Int = HostIp("localhost") 

ipaddress$ = DottedIP$(ip) 

Print "Dotted IP Test" 
Print "==============" 
Print "Internal Host IP ID:" + ip 
Print "Dotted IP Address:" + ipaddress$ 
Print "" 
Print "Press any key to continue" 

WaitKey() 

?


mongia2(Posted 2006) [#3]
thanks

mongia


siread(Posted 2006) [#4]
That just returns 127.0.0.1

Dotted IP Test
==============
Internal Host IP ID:2130706433
Dotted IP Address:127.0.0.1


tonyg(Posted 2006) [#5]
Then don't put your localhost in the HostIp parm.


Vertex(Posted 2006) [#6]
You can use
http://vertex.dreamfall.at/bnet/bnet160.zip

There are same BlitzBasic Network Commands for TCP and UDP :)

cu olli


siread(Posted 2006) [#7]
@TonyG
What should you put to find the ip of your own PC?

@Vertex
Is BNet cross-platform?


tonyg(Posted 2006) [#8]
Your hostname.


siread(Posted 2006) [#9]
Aha!

Local hn$ = getenv_("hostname")
Local ip_array:Int[]=HostIps(hn)
ip:Int = HostIp(hn)

ipaddress$ = DottedIP$(ip)

Print "Dotted IP Test"
Print "=============="
Print "Internal Host IP ID:" + ip
Print "Dotted IP Address:" + ipaddress$
Print ""
Print "Press any key to continue"

WaitKey()


So blitz can find out the hostname without the user having to type it in manually! Cool. :)


mongia2(Posted 2006) [#10]
perfect thanks

mongia


tonyg(Posted 2006) [#11]
I don't think that's douing what you think.
The return from getenv_("hostname") is null.
Try
Local ip_array:Int[]=HostIps("")
ip:Int = HostIp("") 

ipaddress$ = DottedIP$(ip) 

Print "Dotted IP Test" 
Print "==============" 
Print "Internal Host IP ID:" + ip 
Print "Dotted IP Address:" + ipaddress$ 
Print "" 
Print "Press any key to continue" 

WaitKey()