convertions network b3d-bmax
BlitzMax Forums/BlitzMax Programming/convertions network b3d-bmax
| ||
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 |
| ||
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() ? |
| ||
thanks mongia |
| ||
That just returns 127.0.0.1 Dotted IP Test ============== Internal Host IP ID:2130706433 Dotted IP Address:127.0.0.1 |
| ||
Then don't put your localhost in the HostIp parm. |
| ||
You can use http://vertex.dreamfall.at/bnet/bnet160.zip There are same BlitzBasic Network Commands for TCP and UDP :) cu olli |
| ||
@TonyG What should you put to find the ip of your own PC? @Vertex Is BNet cross-platform? |
| ||
Your hostname. |
| ||
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. :) |
| ||
perfect thanks mongia |
| ||
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() |