There can be many ways to do it.
Basically there is a client (Frame/applet) running on HOST-A which needs to upload to HOST-B.
The client on HOST-A cannot directly access the file-system of the HOST-B. What we need is a server running on HOST-B which can receive data from a client and write to the local file system. HOST-A will then establish a socket connection with the server on HOST-B and pass data through the socket to the server and the server will write the data to the local file system.
The server on HOST-B can be based on internet protocols or it can be your own custom protocol.
Your subject mentions FTP- so apparently you want to use FTP protocol. For this you need to start an FTP server on HOST-B. Then use the URL & URLConnection classes in your client (application/applet) to establish connection with the ftp server. You can use the setRequestProperty() to set the method to 'store' because that is the method used for file uploading. Then you need to get an OutputStream from the URLConnection, and then write obtain the contents of your file (through RAF/FileInputStream etc) and write the contents through the Output Stream. The ftp server on HOST-B will do the rest.
Instead of using an FTP server you may use a web-server running on HOST-B to call a
servlet. You can make a servlet, which would obtain data from doPost() method and write the data to the local file system. Such a servlet can also be invoked by using URL/URLConnection classes on your client running on HOST-A.
Instead of using ftp/web-server, you may design your own lightweight server running on your specified port on HOST-B. The server will set up a ServerSocket() to listen to requests from the remote client. The remote client (HOST-A) will then open a socket connection using Socket class, then get an output stream and write the file contents to the output stream. The server on HOST-B will receive the contents through the input stream obtained from its socket and then write to the local file system of HOST-B.
Instead of using Socket, you may use RMI Server running on HOST-B. Expose a method in the RemoteInterface such as write(
String, file), which will be implemented by the RMI Server. The client on HOST-A will then call the write() method to upload the contents of the file to HOST-B.