• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Looking up webserver's hostname from applet

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've designed an applet that connects to a custom server running on the same machine as the webserver. There aren't any issues making the actual connection. The question I have, however, is how to properly find the webserver hostname without hard-coding it into the applet. As I see it (and there are other ways please add) there are two ways to set the desired webserver hostname:

1) As a parameter to the applet coded into the applet on the HTML file. For example: <param name=host value='hostname'>
2) The applet could look up the server's hostname

Option 1 works fine but is there an easy way to look up the webserver's hostname from within an Applet as in option 2?

-Dave
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applet.getCodeBase()
or
Applet.getDocumentBase()

should work for you
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!