Java Application and the host from where it is loaded ?

Application Host!

I have earlier experience mainly with Applets, im now interested of testing an Java Application for my chess game.
When im on applets i can always have firewall free TCP/UDP two way transfer between the host from where applet is loaded and applet itself, with

"applet.getcodebase().gethost()".

Now as i go to sandboxed webstarted application, then how to get the inetaddress of an host from where sandboxed webstart application is loaded ?

And is the resolving inetaddress allways a two ways like the applet has ?

http://download.oracle.com/javase/1.5.0/docs/guide/javaws/jnlp/javax/jnlp/BasicService.html

Would make things pretty simple to simply connect to IP Inetaddress of my server ? is this enough on/for every client, can webstart application also work this ways ?
Or is there special ways how getcodebase().gethost() works and is handled on JVM, so direct inetaddress is not enough to open two way transfer without firewall ?

I don’t get it. I gave the answer: the JNLP API

Why don’t you try it, and come back with your results?

My humble knowledge of Java failed this time, i have no other experience on Interfaces than keyboard and mouse listeners.
I think i need few hours to understand how to activate BasicService, eh ;D

Google to the rescue:

http://download.oracle.com/javase/1.4.2/docs/guide/jws/developersguide/examples.html

I made an following method ->


public String getCodeBaseInetAddress ( )
{
	try
	{
		BasicService bs = ( BasicService ) ServiceManager.lookup ( "javax.jnlp.BasicService" ) ;
		return bs.getCodeBase ( ).getHost ( ) ;
	}
	catch ( UnavailableServiceException ue )
	{
		return "" ;
	}
}

There was an jnlp.jar file i needed to download, it was 6.9k file, i later need to check if it needs to be signed or if it can be pack200.gz packed.
That method wont return error, i check this tomorrow, thanks and good night.


My second question on this getcodebase().gethost(), would it be ok, to just use every time the inetaddress.getbyname(IPTOMYSERVER); rather than this 6.9k packet ?
is there JVM things that activate when using getcodebase().gethost() rather than direct IP ?