|
Pages: [1]
|
 |
|
Author
|
Topic: how to find my own ip address (Read 1149 times)
|
nogoodboyo
Guest
|
Can anyone help with this? I want to find the internet address of a PC and email the result. The email bit I can do :->. Thanks, NGB.
|
|
|
|
|
Logged
|
|
|
|
|
CarlRead
|
I'm not sure what you mean. PCs don't have an internet address, though servers running on them will have and when the computer connects to the internet they'll be given one, though it may not be the same address every time they connect. (Depends on the ISP they're going though and so on.) So, do you want to find out your own address, or someone elses somewhere out on the net? To get addresses from domain names is simple... >> print read dns://www.rebol.com 216.193.197.238 as is doing the reverse... >> print read dns://216.193.197.238 rebol.com If you have a server running with REBOL on it, you can get the address of those who visit a page, (meaning a page generated by one of your CGI scripts), by creating a script based on the info here... http://www.rebol.com/docs/core23/rebolcore...ml#section-13.4You could find your own address then by surfing to that page, or the addresses of any others you can entice there. I don't know of other methods, but then network protocols are not my strong point.
|
|
|
|
|
Logged
|
- Carl Read
|
|
|
|
Gabriele
|
If you only have one network interface, it may be enough for you to check system/network/host-address. Otherwise, since usually you are interested in the address of the interface connected to the Internet, the best way is: port: open tcp://www.rebol.com:80 print port/local-ip
It's also possible to get a list of all the network interfaces in your PC: port: open udp:// print mold get-modes port 'interfaces
Of course, if you're under NAT none of the above will help, if you want to know your public IP...
|
|
|
|
|
Logged
|
|
|
|
|
notchent
|
This displays the current WAN and LAN IP addresses of your computer: parse read http://whatismyip.com [thru <title> copy my-ip to </title>] parse my-ip [thru "-" copy stripped-ip to end] alert to-string rejoin ["WAN: " stripped-ip " ---- LAN: " read join dns:// read dns://] ( from http://musiclessonz.com/rebol.html )
|
|
|
|
|
Logged
|
|
|
|
|
|
|
notchent
|
Hi Graham,
Is the source for that available?
|
|
|
|
|
Logged
|
|
|
|
|
Graham
|
Here it is .. unedited #!/path/to/rebol -cs
REBOL [ Title: "Find remote IP address" Date: 1-Jun-2001 Version: 0.0.1 File: %whatismyip.r Author: "Graham Chiu" Purpose: { } History: [ ] Category: [cgi ldc net tcp util 3] Examples: { } Note: { } ]
print "Content-type: text/html^/^/"
test: false ; system/options/cgi/remote-addr ; enables local test mode
either test [ cgi: context [ remote-addr: "1.2.3.4" query-string: "cmd=post&service=chat&name=sean&data=9080" ]
][ cgi: system/options/cgi ]
ip: to-tuple cgi/remote-addr
if not error? try [ proxy-ip: to-tuple first parse select cgi/other-headers "HTTP_X_FORWARDED_FOR" "," ][ ip: proxy-ip ]
print [ <ip> ip </ip> ] quit
|
|
|
|
|
Logged
|
|
|
|
|
|
|
|
Pages: [1]
|
|
|
 |
News: 01-09-08 Alpha version of REBOL 3 has been released!
2287 Posts in 593 Topics by 3732 Members
Latest Member: Hentai40
|