dcsimg
Problem sending uid to FTP server - no firewall
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ron_Masters
Posted On:   Tuesday, July 15, 2003 09:12 AM

I am trying to add FTP functionality to an application. This app creates a product file and I want to add a button to ftp this file to the clients web site. However having problems sending the UID. Get response: 500 myuserid not understood. Code example Socket s = new Socket ("isp.com",21); System.out.println ("we have a socket connection"); BufferedReader in = new BufferedReader (new InputStreamReader(s.getInputStream())); OutputStream ftpout = s.getOutputStream(); PrintWriter pwout = new PrintWriter (s.getOutputStream()); PrintWriter out = new PrintWriter(s.getOutputStream(), true); String u   More>>

I am trying to add FTP functionality to an application.
This app creates a product file and I want to add a button
to ftp this file to the clients web site.
However having problems sending the UID.
Get response: 500 myuserid not understood.


Code example

			

Socket s = new Socket ("isp.com",21);
System.out.println ("we have a socket connection");

BufferedReader in = new BufferedReader (new
InputStreamReader(s.getInputStream()));
OutputStream ftpout = s.getOutputStream();
PrintWriter pwout = new PrintWriter (s.getOutputStream());
PrintWriter out = new PrintWriter(s.getOutputStream(), true);

String uid = "myuserid";
String pwd = "mypassword

";

String line;
while ((line = in.readLine()) != null)
{
line_num++;
System.out.println ("read line "+line_num+": "+ line);

if (line_num == 1)
{
System.out.println ("Sending user id to ftp host");
out.println(uid);
out.flush();
}
.
.



			
Output:
we have a socket connection
read line 1: 220 ProFTPD 1.2.4 Server (ProFTPD) [hostname]
Sending user id to ftp host
read line 2: 500 myuserid not understood.
Sending pwd to ftp host
read line 3: 500 mypassword not understood.



Hope someone can help me. Ron...    <<Less

Re: Problem sending uid to FTP server - no firewall

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, July 15, 2003 12:08 PM

Also if you are really going to work on this, you better learn the actual protocol from the RFC's... at least type "help" to an "ftp>" prompt and see the list of commands available!

The FTP command line to send a username has to start with the verb, e.g. "USER myuserid"....

Re: Problem sending uid to FTP server - no firewall

Posted By:   Steven_Martin  
Posted On:   Tuesday, July 15, 2003 11:44 AM

I would use the NetComponents (Commons) library instead. It's available at jakarta.apache.org
About | Sitemap | Contact