Discussions

EJB programming & troubleshooting: Programme to Download a file

  1. Programme to Download a file (2 messages)

    How to write a programme to download from a server
  2. Hi,
    This is one of the classic applications that can be developed using Sockets (java.net.*). U essentially need to write a program that listens to a particular port and runs in the server mode i.e. ServerSocket. On the client side u write a client socket program that will issue appropriate file download message, may be a proprietory protocol, containing the filename.
    So in short open a I/O Stream on the client side and send the filename, On the server side try reading the file from a location using FileInputStream. Read these bytes on server and write them to the outputstream of the client socket.
    I think this is one of the basic ways to go about it.
    Cheers
  3. Hi kirubakaran ,

    Other way, can be ‘Web Server + Servlet’ combination. You can write a servlet that allows user to down load / upload file.

    Example of such case can be found in any JSP beginner's book


    Cheers,
    @bhijit