GLBasic User Manual

Main sections


ip$ = NETGETIP$()

This command gets you a list of the IP addresses that are allocated to your computer, so you can tell others what they are.
The IPs are separated by "|" and can be separated with SPLITSTR.
Note : If you are writing an application to talk to systems across the internet rather than over a local network, the IP addresses returned from this command may not be the right ones for other systems to connect to. You may need to check your internet router to see what your internet facing IP address is.

The NET... commands give network functionality to GLBasic programs using the TCP protocol. TCP has the advantage over other protocols that sending and receiving of network messages is ensured.

NOTE : This command requires that you have purchased either GLBasic Premium or the GLBasic NET add-on.

FUNCTION ReadHighScores: names$[], scores[], username$, thescore
LOCAL ct, i, str$, proxy$, port

    str$ = "highscores/listgame.php"
    str$ = str$ + "?game=mygame"
    str$ = str$ + "&name="+username$
    str$ = str$ + "&score="+thescore
    str$ = str$ + "&secret=mycode"

    PRINT ".: WebGet scores :.", 0, 0

    INIOPEN "config.ini"
    proxy$ = INIGET$("server", "proxy")
    port = INIGET$("server", "port")
    KILLFILE "scores.ini"
    IF port=0 OR proxy$="NO_DATA"
        NETWEBGET("", "/"+str$, 80, "scores.ini")
        NETWEBGET(proxy$, "" + str$, port, "scores.ini")

    INIOPEN "scores.ini"
    ct = INIGET$("scores", "count")
    DIM names$[ct]
    DIM scores[ct]

    FOR i=1 TO ct
        names$[i-1] = INIGET$("scores", "n"+i)
        scores[i-1] = INIGET$("scores", "s"+i)

See also...