IP Configuration
From QB64 Wiki
There are two IP addresses that you may need to Host a session.
Local IP Address: The following function will return your local IP address.
PRINT GetLocalIP$ FUNCTION GetLocalIP$ SHELL _HIDE "cmd /c ipconfig > IPconfig.tmp" OPEN "IPconfig.tmp" FOR INPUT AS #1 DO LINE INPUT #1, ipline$ IF LEFT$(LTRIM$(ipline$), 2) = "IP" THEN CLOSE #1 GetLocalIP$ = MID$(ipline$, INSTR(ipline$, ":") + 1) KILL "IPconfig.tmp" 'kill the messenger? EXIT DO END IF LOOP UNTIL EOF(1) END FUNCTION
- Note: If the file is not found use "CMD /C ipconfig > IPconfig.tmp" command line on some systems!
Global IP Address: You need to supply this address to have others connect to you as Host.
PRINT HostAddress$ FUNCTION HostAddress$ Host = _OPENHOST("TCP/IP:319") HostAddress$ = _CONNECTIONADDRESS(Host) END FUNCTION
- Warning! This procedure may be blocked by your Firewall or need your permission to be completed!
- If you get an address like 127.0.0.1 the firewall is blocking the access!
- If you find this to be a problem with others using QB64 please report it at the forum!
- Warning! This procedure may be blocked by your Firewall or need your permission to be completed!
- Your Clients may need your latest Global IP Address as a Host if your server assigns you a dynamic address that changes!
See also:
- _OPENHOST
- _CONNECTIONADDRESS
- WGET (HTTP and FTP file transfer)
- TCP/IP Message Format
- Downloading Files