ftp
ftp copied to clipboard
229 Entering Extended Passive Mode (|||45368|) when attempting to read the file repeatedly after creating a connection only once. Report an error
trafficstars
func t(filePath string) {
c, err := ftp.Dial(ftpServer, ftp.DialWithTimeout(5*time.Second))
if err != nil {
log.Fatal(fmt.Sprintf("filePath: %s err: %v", filePath, err))
}
err = c.Login(ftpUser, ftpPasswd)
if err != nil {
log.Fatal(fmt.Sprintf("filePath: %s err: %v", filePath, err))
}
for i := 0; i < 5; i++ {
_, err := c.Retr(filePath)
if err != nil {
log.Fatal(fmt.Sprintf("filePath: %s err: %v", filePath, err))
}
}
if err := c.Quit(); err != nil {
log.Fatal(err)
}
}