• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help regarding URL class ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?



     
    William Brogden
    Author and all-around good cowpoke
    Rancher
    Posts: 13071
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic