Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/src/commands/directory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ class FTPDirectory {
// Enter passive mode
FTPReply response = await _socket.openDataTransferChannel();

// Directoy content listing, the response will be handled by another socket
_socket.sendCommandWithoutWaitingResponse(_socket.listCommand.describeEnum);

// Data transfer socket
int iPort = Utils.parsePort(response.message, _socket.supportIPV6);
Socket dataSocket = await Socket.connect(_socket.host, iPort,
timeout: Duration(seconds: _socket.timeout));

// Directoy content listing, the response will be handled by another socket
_socket.sendCommandWithoutWaitingResponse(_socket.listCommand.describeEnum);

//Test if second socket connection accepted or not
response = await _socket.readResponse();
//some server return two lines 125 and 226 for transfer finished
Expand Down
14 changes: 8 additions & 6 deletions lib/src/commands/file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ class FTPFile {
// Enter passive mode
FTPReply response = await _socket.openDataTransferChannel();

//the response will be the file, witch will be loaded with another socket
_socket.sendCommandWithoutWaitingResponse('RETR $sRemoteName');

// Data Transfer Socket
int lPort = Utils.parsePort(response.message, _socket.supportIPV6);
_socket.logger.log('Opening DataSocket to Port $lPort');
final Socket dataSocket = await Socket.connect(_socket.host, lPort,
timeout: Duration(seconds: _socket.timeout));

// The response will be the file, which will be loaded with another socket
_socket.sendCommandWithoutWaitingResponse('RETR $sRemoteName');

// Test if second socket connection accepted or not
response = await _socket.readResponse();
//some server return two lines 125 and 226 for transfer finished
Expand Down Expand Up @@ -136,13 +137,14 @@ class FTPFile {
sFilename = basename(fFile.path);
}

// The response is the file to upload, witch will be managed by another socket
_socket.sendCommandWithoutWaitingResponse('STOR $sFilename');

// Data Transfer Socket
int iPort = Utils.parsePort(response.message, _socket.supportIPV6);
_socket.logger.log('Opening DataSocket to Port $iPort');
final Socket dataSocket = await Socket.connect(_socket.host, iPort);

// The response is the file to upload, witch will be managed by another socket
_socket.sendCommandWithoutWaitingResponse('STOR $sFilename');

//Test if second socket connection accepted or not
response = await _socket.readResponse();
//some server return two lines 125 and 226 for transfer finished
Expand Down
2 changes: 1 addition & 1 deletion lib/src/ftp_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FTPEntry {
r"(\d+)\s+" // Number of items [3]
r"(\w+)\s+" // File owner [4]
r"(\w+)\s+" // File group [5]
r"(\d+)\s+" // File size in bytes [6]
r"(\-?\d+)\s+" // File size in bytes [6]
r"(\w{3}\s+\d{1,2}\s+(?:\d{1,2}:\d{1,2}|\d{4}))\s+" // date[7]
r"(.+)$" //file/dir name[8]
);
Expand Down