• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Query on http and ftp Protocols

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
First, I am not sure I am posting this query in the right Forum�Moderators please check it out?
Yesterday someone asked me a very good question i.e. how to write code on you're web site that will invoke a File down load on the client Machine. It is same thing that we all very commonly used to down load free software packages on net.
I don't know how this thing works that's why I am posting this query here so that I can have expert opinion from Java Guru's.
Here I am writing what I know: Among all the protocols available to communicate between client machine and a server we are now using http protocol. It has the advantage that it is very effective for hypertext transfer as well as it can do file transfer. We need have to go separately for ftp protocols when we have to transfer small files or when we r transferring files in pieces. In ftp protocol all the file is send in one go from server to the client machine where as in http protocol same file is send in pieces. When downloading of one piece is completed then another piece (packet) is send from server.
This is what I think is the basic difference between the two protocols.
Other thing I want to clarify is: I am sending a request to a server, which has a listener, which listen only to http protocol. And send response back to client machine in http protocol. Can there be a situation that the listener at the server is listening only on http protocol and sending back request using ftp protocol? Because our browser is not protocol specific. It can communicate (send and receive) from the server using any protocol.
Please tell me if I make any sense? I know my knowledge is limited and there for I am looking for you Java Guru's for help, Please guide me.
Have a Nice Day,
Regards,
Raj.
 
Rajpal Kandhari
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,

After waiting for three days I am wonder that I have not made any sense In above talk.......
But still can any one Please take pain in going through what I have written and pls give me you're expert comments...
Thanks
Regards
Raj.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whew, sorry, this question winds up being broad enough to encompas a small book. But, I'll try and take a stab at it. From the server side, it's extremely difficult to envoke a send of anything to a client without them in some way initiating the communication. You can cause a file to be downloaded on a clients machine using several methods however. You can include a javascript which does a timed redirect to the file to be downloaded which will cause the browser (if javascript enabled) to download the file. You can send the file as a response to a request. One final thing you can do is to grab the clients URL and 'push' the file to their browser. However they are going to get the message to save or open and the ability to cancel the download.
FTP and HTTP actually work much the same in that the data is sent in packets between the client and the server. The size of these packets are determined by an agreement between the two and the network connection, the better the connection the bigger the packets. The main difference in the packets is the amount of header and trailer information each contain. HTTP includes a lot more data therefore it takes longer for information to be transferred.
The largest difference between the two protocols is the state of the connection. HTTP will only maintain the state for a singel request and response. For a server to recognize a client for a second request, 'session' information is needed. This information can be in the form of a cookie, information in the url request, information in the http header etc. FTP is a sessioned protocol once you connect and login, your connection is maintained between commands until it is closed bu either the client or the server.
Hope this sheads a little more light, Though it diffinatly isn't intended to be complete or exhaustive so....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic