This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

eof question.

Old posts that have not been replied to for several years.
Locked
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

eof question.

Post by Ofloo »

I want to make script that crawls ftp servers automatic and writes its content to a mysql or csv database, first problem is if i use connect

set idx [connect <hostname> <port>]

if the connection failed, an EOF will arrive for that idx i do know this but what does an eof react to or what does it show ?

so the question is actualy how do i use eof on this ? or how is eof used .?
XplaiN but think of me as stupid
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The connect command is a eggdrop provided command and seperate to the Tcl file handler and socket support.

If a connection is closed (or EOF), your proc shoudl receive a blank like. In Tcl terms, the input text == ""
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

could you give a small example not sur on what you mean ..? just wana know how you trigger an eof
XplaiN but think of me as stupid
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Ofloo wrote:could you give a small example not sur on what you mean ..? just wana know how you trigger an eof
Hi there Ofloo. An example script can be found at:
http://members.fortunecity.com/eggheadtcl
script: demo-ftpconnect.tcl

In case of a connection that fails because of a DNS lookup error or a connection refused, the [connect] immediately fails which must be catch'ed.
If the connection succeeds the FTP server will send a status code 220 to indicate the server is ready to accept commands.
If the FTP server closes a connection, a blank line will be send to your script.
(Note that if the FTP server sends a blank line, nothing will be send to your script.)

There are some things you may want to (re)consider.

1. If you do want to write your own script you will have to dive a bit into the FTP RFC. Additionally, if you are new to listen/connect/control or Tcl socket programming you probably will need to put quite some time into it.

2. There is a FTP package available in the standard tcllib. Use google to locate the tcllib on e.g. sourceforge. This package may give you a more convenient interface between your eggdrop and an FTP server.

3. Also a shell program like "wget" can connect to ftp servers and download the directory listings. Using such shell program may offer another convenient interface.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

i do know these things and i want to learn it all ;) hehe i do know that it will take some time just wanted a push in the write direction tnx for the info ;)
XplaiN but think of me as stupid
Locked