Issues Getting file list from FTPS

Dec 1, 2010 at 11:54 PM

Hi guys,

I am using the alex ftps client library in my application and am able to connec to connect to ftps (loacal ftps created by filezilla). All the commands works fine. However, when i try to connect to a remote ftps server, it connects fine.

 

 

 

stream

s = GetDataStream();

 

StringBuilder data = new StringBuilder

();

byte[] buf = new byte

[1024];

int

n = 0;

do

 

{

n = s.Read(buf, 0, buf.Length);   ///this never turns anything always empty.

 

 

data.Append(Encoding

.UTF8.GetString(buf, 0, n));

}

while

(n != 0);

return

data.ToString();

 

 

The log on server look something like this:

  

[02] Wed 01Dec10 15:04:49 - (009061) Connected to xxxxx(local address xxxx, port 990)
[21] Wed 01Dec10 15:04:49 - (009061) 220 Serv-U FTP Server v10.2 ready...
[20] Wed 01Dec10 15:04:55 - (009061) USER tr_devon_canada
[21] Wed 01Dec10 15:04:55 - (009061) 331 User name okay, need password.
[20] Wed 01Dec10 15:04:55 - (009061) PASS **********
[02] Wed 01Dec10 15:04:55 - (009061) User "tr_devon_canada" logged in
[21] Wed 01Dec10 15:04:55 - (009061) 230-User logged in, proceed.
[21] Wed 01Dec10 15:04:55 - (009061) 230-   ***************************************
[21] Wed 01Dec10 15:04:55 - (009061) 230-   ***************************************
[21] Wed 01Dec10 15:04:55 - (009061) 230-   xx[[21] Wed 01Dec10 15:04:55 - (009061) 230-
[21] Wed 01Dec10 15:04:55 - (009061) 230-    - - - - Important Notice - - - -
[21] Wed 01Dec10 15:04:55 - (009061) 230-   This system is property of Fx
[21] Wed 01Dec10 15:04:55 - (009061) 230-   Solutions Canada Inc.
[21] Wed 01Dec10 15:04:55 - (009061) 230-
[21] Wed 01Dec10 15:04:55 - (009061) 230-   Unauthorized access or use is strictly
[21] Wed 01Dec10 15:04:55 - (009061) 230-   prohibited. Your activity may be
[21] Wed 01Dec10 15:04:55 - (009061) 230-   monitored. Data residing on this
[21] Wed 01Dec10 15:04:55 - (009061) 230-   system may also be subjected to a
[21] Wed 01Dec10 15:04:55 - (009061) 230-   retention policy.
[21] Wed 01Dec10 15:04:55 - (009061) 230-
[21] Wed 01Dec10 15:04:55 - (009061) 230-   Questions?: Please contact us at
[21] Wed 01Dec10 15:04:55 - (009061) 230-   +1.x
[21] Wed 01Dec10 15:04:55 - (009061) 230-   x

[02] Wed 01Dec10 15:04:49 - (009061) Connected to xxxxx(local address xxxx, port 990)
[21] Wed 01Dec10 15:04:49 - (009061) 220 Serv-U FTP Server v10.2 ready...
[20] Wed 01Dec10 15:04:55 - (009061) USER tr_devon_canada
[21] Wed 01Dec10 15:04:55 - (009061) 331 User name okay, need password.
[20] Wed 01Dec10 15:04:55 - (009061) PASS **********
[02] Wed 01Dec10 15:04:55 - (009061) User "tr_devon_canada" logged in
[21] Wed 01Dec10 15:04:55 - (009061) 230-User logged in, proceed.
[21] Wed 01Dec10 15:04:55 - (009061) 230-   ***************************************
[21] Wed 01Dec10 15:04:55 - (009061) 230-   ***************************************
[21] Wed 01Dec10 15:04:55 - (009061) 230-   xx[[21] Wed 01Dec10 15:04:55 - (009061) 230-
[21] Wed 01Dec10 15:04:55 - (009061) 230-    - - - - Important Notice - - - -
[21] Wed 01Dec10 15:04:55 - (009061) 230-   This system is property of Fx
[21] Wed 01Dec10 15:04:55 - (009061) 230-   Solutions Canada Inc.
[21] Wed 01Dec10 15:04:55 - (009061) 230-
[21] Wed 01Dec10 15:04:55 - (009061) 230-   Unauthorized access or use is strictly
[21] Wed 01Dec10 15:04:55 - (009061) 230-   prohibited. Your activity may be
[21] Wed 01Dec10 15:04:55 - (009061) 230-   monitored. Data residing on this
[21] Wed 01Dec10 15:04:55 - (009061) 230-   system may also be subjected to a
[21] Wed 01Dec10 15:04:55 - (009061) 230-   retention policy.
[21] Wed 01Dec10 15:04:55 - (009061) 230-
[21] Wed 01Dec10 15:04:55 - (009061) 230-   Questions?: Please contact us at
[21] Wed 01Dec10 15:04:55 - (009061) 230-   +1.x
[21] Wed 01Dec10 15:04:55 - (009061) 230-   x

[21] Wed 01Dec10 15:04:55 - (009061) 230-
[21] Wed 01Dec10 15:04:55 - (009061) 230-   Thank you!
[21] Wed 01Dec10 15:04:55 - (009061) 230-   ***************************************
[21] Wed 01Dec10 15:04:55 - (009061) 230    ***************************************
[20] Wed 01Dec10 15:04:55 - (009061) FEAT
[21] Wed 01Dec10 15:04:55 - (009061) 211-Extensions supported
[21] Wed 01Dec10 15:04:55 - (009061)  UTF8
[21] Wed 01Dec10 15:04:55 - (009061)  OPTS MODE;MLST;UTF8
[21] Wed 01Dec10 15:04:55 - (009061)  CLNT
[21] Wed 01Dec10 15:04:55 - (009061)  CSID Name; Version;
[21] Wed 01Dec10 15:04:55 - (009061)  HOST domain
[21] Wed 01Dec10 15:04:55 - (009061)  SITE PSWD;SET;ZONE;CHMOD;MSG;EXEC;HELP
[21] Wed 01Dec10 15:04:55 - (009061)  AUTH TLS;SSL;TLS-C;TLS-P;
[21] Wed 01Dec10 15:04:55 - (009061)  PBSZ
[21] Wed 01Dec10 15:04:55 - (009061)  PROT
[21] Wed 01Dec10 15:04:55 - (009061)  CCC
[21] Wed 01Dec10 15:04:55 - (009061)  SSCN
[21] Wed 01Dec10 15:04:55 - (009061)  RMDA directoryname
[21] Wed 01Dec10 15:04:55 - (009061)  DSIZ
[21] Wed 01Dec10 15:04:55 - (009061)  AVBL
[21] Wed 01Dec10 15:04:55 - (009061)  EPRT
[21] Wed 01Dec10 15:04:55 - (009061)  EPSV
[21] Wed 01Dec10 15:04:55 - (009061)  MODE Z
[21] Wed 01Dec10 15:04:55 - (009061)  THMB BMP|JPEG|GIF|TIFF|PNG max_width max_height pathname
[21] Wed 01Dec10 15:04:55 - (009061)  REST STREAM
[21] Wed 01Dec10 15:04:55 - (009061)  SIZE
[21] Wed 01Dec10 15:04:55 - (009061)  MDTM
[21] Wed 01Dec10 15:04:55 - (009061)  MDTM YYYYMMDDHHMMSS[+-TZ];filename
[21] Wed 01Dec10 15:04:55 - (009061)  MFMT
[21] Wed 01Dec10 15:04:55 - (009061)  MFCT
[21] Wed 01Dec10 15:04:55 - (009061)  MFF Create;Modify;
[21] Wed 01Dec10 15:04:55 - (009061)  XCRC filename;start;end
[21] Wed 01Dec10 15:04:55 - (009061)  MLST Type*;Size*;Create;Modify*;Perm;Win32.ea;Win32.dt;Win32.dl
[21] Wed 01Dec10 15:04:55 - (009061) 211 End (for details use "HELP commmand" where command is the command of interest)
[20] Wed 01Dec10 15:04:55 - (009061) CLNT AlexFTPS
[21] Wed 01Dec10 15:04:55 - (009061) 200 Noted.
20] Wed 01Dec10 15:04:55 - (009061) OPTS UTF8 ON
[21] Wed 01Dec10 15:04:55 - (009061) 200 OPTS UTF8 is set to ON.
[20] Wed 01Dec10 15:04:55 - (009061) TYPE I
[21] Wed 01Dec10 15:04:55 - (009061) 200 Type set to I.
[20] Wed 01Dec10 15:04:55 - (009061) CWD Upload
[21] Wed 01Dec10 15:04:55 - (009061) 250 Directory changed to /Upload

[20] Wed 01Dec10 15:06:47 - (009061) PASV
[21] Wed 01Dec10 15:06:47 - (009061) 227 Entering Passive Mode (xxxx)
[20] Wed 01Dec10 15:06:47 - (009061) LIST
[21] Wed 01Dec10 15:06:47 - (009061) 150 Opening ASCII mode data connection for /bin/ls.
[21] Wed 01Dec10 15:06:48 - (009061) 226 Transfer complete. 0 bytes transferred. 0.00 KB/sec.

 

If i use a client like core ftp or somethign the dsta trsnsfter is correct and i get the list of files.

 

 

Any help is highly appriciated.

Dec 2, 2010 at 8:46 PM

Resolved the issue by giving few extra PROT P and C and BSCV 0 something commands.

Awesome work alex.

Coordinator
Dec 2, 2010 at 9:27 PM

Great! :-)

 

Cheers,

Alessandro Pilotti

[MVP / IIS]