Computer Science Canada

Needing Help on Keeping Track of Websites

Author:  Anonymous [ Fri May 26, 2006 2:03 pm ]
Post subject:  Needing Help on Keeping Track of Websites

Im working on gathering IP addresses from site's I connect to. So I want to keep track of a file so if I enter a website, and that and the IP address if already in my file, it lists the IP without connecting, speeding up my program (it takes long to connect). But no matter what I do, it seems to have to connect. Here is my code:

code:

var fileID, connection : int
var msg, address, IP : string
var name := "Website's IP's.txt"

put "Enter the address you wish to retrieve their hosts IP address."
get address

if File.Exists (name) then
    open : fileID, name, get
    loop
        exit when eof (fileID)
        get : fileID, msg : *
    end loop
    close : fileID
end if

/********CONNECTION BLOCK******************/
connection := Net.OpenConnection (address, 25)
IP := Net.HostAddressFromName (address)
put address, " = ", IP
/******************************************/

open : fileID, name, put, get, mod
loop
    exit when eof (fileID)
    get : fileID, msg
    if (msg = address) then
        locate (2, 1)
        put msg
        return
    end if
end loop
put : fileID, address, " = ", IP
close : fileID


There has to be an if statement somewhere, I'm guessing, which determines if the address has already been entered, then connect. But I get so confused in where to place it, and I always get errors. Please help.

Author:  MysticVegeta [ Fri May 26, 2006 2:16 pm ]
Post subject: 

Where is the part where you "put" the addresses inside the file?

Author:  Anonymous [ Fri May 26, 2006 2:33 pm ]
Post subject:  Yay

Thanks. Right after that put : is there I put that block =)


: