Codesnippets > Network

What's my IP?


Kitty Hello:

--- Code: (glbasic) ---STDOUT "Local IP(s) (for LAN connection): \n" _
+ REPLACE$(NETGETIP$(), "|", "\n")+"\n"

LOCAL myip$, proxy$, port%
// proxy$ = ""
// port   = 3128

IF port=0 OR LEN(proxy$)=0
// direct connection
myip$=NETWEBGET$("", "/automation/n09230945.asp", 80, 512)
// through proxy server
myip$=NETWEBGET$(proxy$, "", port, 512)

STDOUT "Internet IP:\n"+myip$+"\n"

--- End code ---

That code snippet appears to be wrong. When specified with a proxy, the last field is the file to write the contents of the webpage to, not the number of bytes to read.

Kitty Hello:
don't mix NETWEBGET and NETWEBGET$ !!!

I'll test it again tomorrow when I'm at work (ie. behind a proxy) - the documentation is missing in the helpfile for forms of NETWEBGET other than

--- Code: (glbasic) ---contents$ = NETWEBGET$(server$, path$, port%, max_length%)
--- End code ---


[0] Message Index

Go to full version