Skip to content

125 Data connection already open; Transfer starting. #29

@netaxcess

Description

@netaxcess

`package main

import (

//"crypto/sha256"

//"crypto/tls"
"fmt"
"io"
"os"

//"encoding/hex"
"github.com/dutchcoders/goftp"

)

func main() {
var err error
var ftp *goftp.FTP
var server = "ftpserver"

// For debug messages: goftp.ConnectDbg("ftpserver")
if ftp, err = goftp.Connect(server); err != nil {
    panic(err)
}
defer ftp.Close()
fmt.Println("Successfully connected to", server)

// TLS client authentication


// Username / password authentication
if err = ftp.Login("ftpuser", "ftppwd"); err != nil {
    panic(err)
}

if err = ftp.Cwd("/ff"); err != nil {
    panic(err)
}

var curpath string
if curpath, err = ftp.Pwd(); err != nil {
    panic(err)
}
fmt.Println("Current path:", curpath)


// Upload a file


// Download each file into local memory, and calculate it's sha256 hash
_,err =ftp.Retr("f.zip", func(r io.Reader) error {
    
	dst, err := os.OpenFile("f.zip", os.O_WRONLY|os.O_CREATE, 0644)
	defer dst.Close() 
	if _, err = io.Copy(dst, r); err != nil {
		return err
	}
	return err
})

}`
use ftp to download zip file,has this error

125 Data connection already open; Transfer starting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions