![]() |
| ||
| URGENT: FTP Client / Server using RMI Hi All. I have been given a task where I have been asked to implement a Java RMI version of an SFTP (Simple File Transfer Protocol) Client / Server. It must use the following commands: list - list files in current directory cd - change directory get filename - copy file from server to client put - upload file from client to server bye - close connection In essence, a FTPServer Factory has to be created which i'm guessing would use the rmi registry to handle requests between the client and server. I have the RMI part figured out, just trying to get the FTP part working... I decided to use the Java Library from JScape Inet Factory and all classes compile, the Ftp Server is running and waits for a connection on port 1099 the designated default RMI port. When the Client starts up it asks user to confirm localhost name and then asks user for username and password, these are hardcoded as "user" and "pass" respectively. The client then begins to log in, the client finds the RMI name through the registry and then trys to log into the FTP server, but everytime it tries to do this it times out as it cannot see the FTP Server. Any ideas?? I have attached code for FTPServer, the Implementation and the Client...any help would be appreciated Thanks RMI FTP SERVER
RMI IMPLEMENTATION package server; FTP RMI CLIENT /* |
| ||
| Re: URGENT: FTP Client / Server using RMI what do you mean, it "cannot see the server"? Log the remote object as it is returned, what are you getting for the endpoint? If your hostsfile is configured wrong your server might pass your clients an incorrect IP address to use when making calls on the remote object, leading to those calls getting lost and the client reporting a "connection refused" or similar error. |
| ||
| Re: URGENT: FTP Client / Server using RMI I decided to use sockets to run the FTP server and call the methods that the FTP Server and Client using RMI, is this correct? Well i've been trying to implement this but everytime I try and launch the server I get an IOException error RmiFtpServer IO Error: Connection refused: connect if i run the server without calling the Socket outgoing call then it works in a way. I thought it could have been my firewall refusing the connection, but then if the program is running on 1 machine would the firewall even be used, i didn't think so. So I opened ports 20 and 21 (FTP Ports) but still produced the same exception error. Any ideas?? RMI SERVER package server;
|
| ||
| Re: URGENT: FTP Client / Server using RMI So, the server can't bind the remote. Hardly surprising if you have no RMI registry running. And you never even try to find the registry you're trying to register your remote object with, so it's no surprise you can't register it. |
| ||
| Re: URGENT: FTP Client / Server using RMI RMI Registry works fine, I created 2 batch files and get output and no RemoteExceptions, I can attach screen shots if necessary |
| ||
| Re: URGENT: FTP Client / Server using RMI Follow up to previous post. I think I have Sockets issued sorted, I called them before initialising RMI and it seems to have worked. I have attached a screenshot of the RMI registry and server running, plus the 2 batch files for jwenting's benefit as he said I wasn't running them. I just need to work out how to run FTP commands using the inetfactory.jar library, i just get connection times out :( Any ideas why the connection is not starting, i think it's something to do with the FTP not seeing the server running despite it being set up as a ServerSocket on port 21...hmmm I will post more code later... Click here for screenshot as mentioned... Thanks |
| ||
| Re: URGENT: FTP Client / Server using RMI RMI as standard runs on port 1099, not port 21. |
| ||
| Re: URGENT: FTP Client / Server using RMI I know that RMI runs on port 1009, but I need to create an FTP Client Server solution so have decided to use Sockets running on port 21 and the File class, i've scrapped using FTP classes. I will just call the methods which simulate FTP commands using the File class via RMI. I will get a workaround solution done later. |
| ||
| Re: URGENT: FTP Client / Server using RMI You can't have it both ways. Either you use RMI and the ports it gives you, or you code your own sockets implementation and use whatever port you want. |
| All times are GMT -4. The time now is 12:07 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC