Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Needing Help on Keeping Track of Websites
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Guest




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Fri May 26, 2006 2:16 pm   Post subject: (No subject)

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




PostPosted: Fri May 26, 2006 2:33 pm   Post subject: Yay

Thanks. Right after that put : is there I put that block =)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: