Re: Connection between PCs on the Internet
- Posted by ChrisB (moderator) Feb 09, 2015
- 1746 views
Hi
I wrote a little programlet to find these out. Its on a linux system, but should be adaptable to a windows system
--separate standalone --in /ipdetect/ipdetect.eui include std/io.e include std/filesys.e include std/regex.e as re sequence ifile, thiscomp = {} object extaddr = {} sequence re_quad object quad_matches system("/sbin/ifconfig > if.txt", 0) ifile = read_lines("if.txt") for i = 1 to length(ifile) do if match("inet addr:", ifile[i]) > 0 then thiscomp = "This computer " & ifile[i][match("inet addr:", ifile[i])..$] exit end if end for --this does not seem to work any more --system("wget -q http://automation.whatismyip.com/n09230945.asp", 0) --try these -- checkip.dyndns.org/ -- checkip.dyndns.org:8245/ -- dynamic.zoneedit.com/checkip.html -- dynupdate.no-ip.com/ip.php --http://box.houkouonchi.jp/ip.php --system("wget -q http://box.houkouonchi.jp/ip.php -O ip_addr.txt", 0) --system("wget -q http://dynamic.zoneedit.com/checkip.html -O ip_addr.txt", 0) system("wget -q http://checkip.dyndns.org -O ip_addr.txt", 0) extaddr = read_lines("ip_addr.txt") --find quad within that line --sometimes the line is HTTP formatted. --sometimes there is more than one line re_quad = re:new("[0-9]+.[0-9]+.[0-9]+.[0-9]+") for i = 1 to length(extaddr) do quad_matches = re:matches(re_quad, extaddr[i]) if sequence(quad_matches) then extaddr[1] = quad_matches[1] exit end if end for if sequence(extaddr) then extaddr = "External ip = " & extaddr[1] else extaddr = "Can't reach ip identifier site" end if puts(1, thiscomp & "\n") puts(1, extaddr & "\n") delete_file("wget.log") delete_file("if.txt") --delete_file("ip_addr.txt")
Another option would be to use dropbox, create shared folders on all the target machines, and just copy the file to the local machine folder, it will appear in the other local machines folder as well.
Just a thought, which has just occurred to me would be useful for a project I'm thinking about now. Thanks sergelli!
Chris