0

I have 3 machines(A, B & C) connected to a Router. A,B & C are in same subnet. All these three machines are interconnected using STAF. I am using machine A as an FTP server & machine B as an FTP client. Using STAF command from machine C I am starting FTP program (TCL script) on machine B.

Now the question is, How C will know whether FTP traffic is flowing between A & B?

oz123
  • 27,559
  • 27
  • 125
  • 187

2 Answers2

0

The ftp package allows you to specify a progress monitor callback in the ftp::Open command:

package require ftp

proc progressMessage {bytesSoFar} {
    puts "Transferred $bytesSoFar; looking good..."
}
set handle [ftp::Open $A $user $pass -progress progressMessage]

# Everything after this is just standard for the ftp package
if {$handle < 0} {
    error "could not connect"
}
if {![ftp::Get $handle $remoteFile $localFile]} {
    ftp::Close $handle
    error "could not transfer"
}
ftp::Close $handle
puts "Transfer completed"

This will print a message every time a chunk is transferred (the chunk size is configurable in the options to ftp::Open via the -blocksize option; it's 4096 by default). On modern networks, this is probably going to write messages very rapidly…

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
-1
package require ftp
set handle [::ftp::Open $host $user $passwd]
if {$handle < 0} {
    error "Connection refused!"
    return 0
}
Vishwadeep Singh
  • 1,043
  • 1
  • 13
  • 38
  • Mere code is not an answer, and this code doesn't detect whether 'FTP traffic is flowing between A and B'. -1 – user207421 Sep 18 '13 at 22:51