• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using URLConnection!

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
URLConnection requires a URL.can URLConnection be used only over a network? can i not use it to interact between two simple java programs,one program sending a name through URLConnection and the other program returning the name reversed.both the programs being stored in one direcory on my PC.what url should be given while instantiating URL object?
i gave the url as "http://localhost:80/d:jdk1.2.1/myPrograms/request" and
"http://localhost:80/d:jdk1.2.1/myPrograms/response"
classes being request.class and response.class
big lot of runtime errors appeared.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
URLConnection needs a valid URL. You can't simply make up your own URL syntax and ask URLConnection to figure it out! The URLs you supply are both pointed at a Web server on the local machine; the "d:\..." part is something that the Web server would have to be configured to understand. URLConnection knows the client end of various Internet protocols, but there has to be a real server for it to talk to.
The bottom line is that if you're going to talk to an HTTP, HTTPS, FTP, or SMTP server, then using URLConnection is a good idea. Otherwise, it's inappropriate.
 
kriti sharma
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic