• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to connect to Windows Machine Using FTPClient...  RSS feed

 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I am trying to connect to a Windows machine from a Sun OS! But when i run the code i get the error:

j

I can understand what the error means but dont know how to resolve it.


My Code is:


 
Paul Clapham
Sheriff
Posts: 22379
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somnath Mallick wrote: I can understand what the error means but dont know how to resolve it.


So what does the error mean? It would be a good idea if you posted that -- you might not really understand it after all. (Since you posted some code, that suggests you might not understand it.)
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you access the FTP site with the username and password using a regular FTP client like FileZilla?

To be honest, I doubt it - the FTP (command) port is 21, not 22. 22 is used for SSH, and you can't use the FTP protocol for that.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well one thing i understood is that the connection is refused maybe because I am using the wrong IP address, or incorrect user name and password. But not more than that!

I tried with 21 as well and it didn't work and i got the same connection refused exception. I posted the code so that you can check out what went wrong. Could it be a firewall issue?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Can you access the FTP site with the username and password using a regular FTP client like FileZilla?
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops forgot to write that!

I tried it through filezilla but didn't connect. Actually I am using an office PC. Many people have used that PC. Also my account is not an administrator account. I tried to connect using my Login Credentials! Do i need the Admin username and password for this?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the problem then has nothing to do with the Java code - it is a general connection problem?
 
Antany Vasanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Somnath

Please verify the ftp services are enabled in your windows machine.

For enabling FTP services in windows go through the following link

http://windowsitpro.com/article/articleid/38646/how-can-i-install-the-ftp-service-under-windows-xp.html

Regards
Antany.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I followed the instruction and completed this task:



A. XP includes a built-in FTP service component that lets FTP clients connect to the machine and read or write files; however, this service doesn't install by default. To install the FTP service, perform the following steps:

1. Start the Control Panel Add/Remove Programs applet (go to Start, Control Panel, then click Add/Remove Programs).
2. Select Add/Remove Windows Components.
3. Select Internet Information Services (IIS), then click Details.
4. Select the File Transfer Protocol (FTP) Service check box, then click OK.
5. Click OK to close all dialog boxes.


But still i get the connection refused issue.
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't set up users or anything yet.

Also, you may prefer the FileZilla FTP server over the IIS one. It's a bit easier to work with, especially with user accounts. IIS can only use the built-in Windows users, if I recall correctly.
 
Antany Vasanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Somnath,

In your windows machine open command prompt and type "ftp localhost". If it prompts for user name then that means you have successfully enabled the FTP Services and the problem is with the communication between two machines.

Try to ping your windows machine from the Sun OS machine from where you are executing the Java program. Also check your firewall settings.

Kindly ensure to use port "21"(Defalut FTP Port)

Regards,
Antany
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies for the late reply.

Thanks Antany. I tried what you mentioned and its working. But the only thing is that which user name and password do i enter? The PC has several user accounts do i enter any of those details or is the FTP user name and password totally different?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!