aspose file tools*
The moose likes Java in General and the fly likes need help regarding URL class ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "need help regarding URL class ?" Watch "need help regarding URL class ?" New topic
Author

need help regarding URL class ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 682

i have some questions regarding URL class in java.net ,
i have 2 q's
  • by using URL class we can download and upload data via http protocol just like what we do using ftp protocol ?
  • suppose i have a code where i m using URL class to connect to localhost 127.0.0.1 through an http protocol so by default this code will conect to port 80 right ? ,
    but the big question is who will receive the data , if suppose i send some data like string ? i m asking this because using socket and server socket we know with whom we are connected or communicating and the server socket (server ) will receive our data and do some processing
    but who will receive the data in case of URL class ?

  • any explanation ?




    The Only way to learn is ...........do!
    Visit my blog http://inaved-momin.blogspot.com/
    William Brogden
    Author and all-around good cowpoke
    Rancher

    Joined: Mar 22, 2000
    Posts: 12682
        
        5
    but who will receive the data in case of URL class ?


    If you create a URL that starts "http" the request will go to a HTTP server living at the specified host and listening at the default port (if you don't specify a port).

    If there is no HTTP server living at that location you will of course get an error.

    Bill

    Java Resources at www.wbrogden.com
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: need help regarding URL class ?
     
    Similar Threads
    OO question: Polymorphism with instanceof
    Protocols
    Implementing java server
    delete using ftp protocol
    My SCEA Part 1Study Notes