; CountHostIPs Example ; -------------------- ; CountHostIPs looks up a host name and returns how many IP ; addresses it has - "localhost" resolves even with no internet. ; The call blocks until the lookup finishes, so do it at load ; time rather than in the middle of a game loop. count=CountHostIPs("localhost") Print "CountHostIPs('localhost') = "+count ; The addresses it found are read back with HostIP, indexed ; from 1 to the returned count For i=1 To count Print " address "+i+": "+DottedIP$(HostIP(i)) Next ; A dotted address works too - it 'resolves' to itself count=CountHostIPs("127.0.0.1") Print "CountHostIPs('127.0.0.1') = "+count ; An unknown name returns 0, so a game can fail gracefully count=CountHostIPs("no-such-host.invalid") Print "CountHostIPs('no-such-host.invalid') = "+count If count=0 Then Print " (name not found - no server to join)" Print "" Print "Press any key to close the example" WaitKey End