Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
8.3k views
in .NET FTP by (280 points)
I am trying to connect to a Siemens Switch/MSC in a mobile operator network. I have code sample in C# but it gives exception when i try to execute connect() statement. I am using edtFTPnet (for .net)
I can download the required files using windows ftp utility (command prompt). using ftp utility i simply login and give 'get TS.CPXX.WE1' and the file gets downloaded.

Following exception is observed when ftpObject.connect() is executed.
Command not implemented PRO01EL4 (code 502)

the code is here...

ftpConnection = new EnterpriseDT.Net.Ftp.FTPConnection();
ftpConnection.ServerAddress = ServerIP;
ftpConnection.UserName = UserName;
ftpConnection.Password = Password;
ftpConnection.LocalDirectory = Environment.CurrentDirectory;
ftpConnection.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.ACTIVE;
ftpConnection.AutoLogin = true;                                
[b]ftpConnection.Connect();   [/b]                          
ftpConnection.DownloadFile(fileName, RemoteFile);


when i try to login to this system using FileZilla it has the following log.

Status: Connecting to 10.175.20.1:21...
Status: Connection established, waiting for welcome message...
Response: 220 SERVICE READY FOR NEW USER. PRO02OC0
Command: USER FTRDONLY
Response: 331 USER NAME OKAY, NEED PASSWORD. PRO01US0
Command: PASS **********
Response: 230 USER LOGGED IN, PROCEED. AUTH0000
Command: SYST
Response: 502 COMMAND NOT IMPLEMENTED. PRO01EL4
Command: FEAT
Response: 500 SYNTAX ERROR, COMMAND UNRECOGNIZED. PRO01EL3
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 502 COMMAND NOT IMPLEMENTED. PRO01EL4
Error: Failed to retrieve directory listing


Any help ?

8 Answers

0 votes
by (162k points)
Set AutoLogin = false, and call Login() after Connect()
0 votes
by (280 points)
Thanks dear,
It solved HALF problem, now i am able to connect/login but the next statement which is downloading file giving exception.

statement is :

ftpConnection.DownloadFile(fileName, RemoteFile);
// values of both parameters are ...
// fileName = "D:\\PAT-Software\\ECN\\prjCPLoad\\prjCPLoad\\bin\\Debug\\ftp\\MSC-5__02122010_0310__TS.CPXX.TH1.raw"
// RemoteFile "TS.CPXX.TH1"

Exception thrown:
Command not implemented PRO01EL4 (code 502)


StackTrace is :
Exception :: at EnterpriseDT.Net.Ftp.FTPClient.GetASCII(String localPath, String remoteFile)
at EnterpriseDT.Net.Ftp.FTPClient.Get(String localPath, String remoteFile)
at EnterpriseDT.Net.Ftp.FTPConnection.DownloadFile(String localPath, String remoteFile)
at prjCPLoad.frmCPLoad.mscParser() in D:\PAT-Software\ECN\prjCPLoad\prjCPLoad\Form1.cs:line 117


------------------------ suggest please...
0 votes
by (162k points)
Can you post the log file from ftp.exe (command line)? Set the mode to 'debug'
0 votes
by (280 points)
C:\Documents and Settings\khalid.mehmood>ftp 10.175.20.1
Connected to 10.175.20.1.
220 SERVICE READY FOR NEW USER. PRO02OC0
User (10.175.20.1:(none)): FTRDONLY
331 USER NAME OKAY, NEED PASSWORD. PRO01US0
Password:
230 USER LOGGED IN, PROCEED. AUTH0000
ftp> debug
Debugging On .
ftp> get TS.CPXX.WE1 DownloadedFile1.txt
---> PORT 10,114,1,240,28,32
200 COMMAND OKAY. PRO01PT0
---> RETR TS.CPXX.WE1
150 FILE STATUS OKAY; ABOUT TO OPEN DATA CONNECTION. PRO01RS0
226 CLOSING DATA CONNECTION; REQUESTED FILE ACTION SUCCESSFUL. PRO03CC0
ftp: 37474 bytes received in 2.06Seconds 18.16Kbytes/sec.
ftp>

---------------------------------------------

file is downloaded to C:\Documents and Settings\khalid.mehmood
0 votes
by (162k points)
Ensure you are transferring in active mode. If it doesn't work in active mode post the fragment of the log file (from edtFTPnet) showing the error.
0 votes
by (280 points)
As you can see, i am using Active Connection Mode. and how can i get fragment of the log file from edtFTPnet ?


ftpConnection = new EnterpriseDT.Net.Ftp.FTPConnection(); 
ftpConnection.ServerAddress = ServerIP; 
ftpConnection.UserName = UserName; 
ftpConnection.Password = Password; 
ftpConnection.LocalDirectory = Environment.CurrentDirectory; 
[b]ftpConnection.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.ACTIVE; [/b]
ftpConnection.AutoLogin = true;                                
[b]ftpConnection.Connect();   [/b]                          
ftpConnection.Login();                 
ftpConnection.DownloadFile(fileName, RemoteFile); 
0 votes
by (162k points)
Read the documentation or search these forums for logging.
0 votes
by (280 points)
however, i have done away with it by using simple windows ftp utility with a bunch of DOS commands...

It works perfect... 8)

Categories

...