By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Sockets in MS' JVM?

P: n/a
Has anyone experienced problems(/solutions) with the use of sockets with
Microsofts JVM. I have to use it to avoid
users having to download the Sun Java plugin. So I'm compiling with:
javac -target 1.1 foo.java
I'm simply trying to connect to the localhost:

socket = new Socket("127.0.0.1", port);

*Nothing* happens..no exceptions!

Kind regards - Jesper
Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a

"Jesper Matthiesen" <jmatthiesen[_fjen_]@tiscali.dk> wrote in message
news:p1*********************@news000.worldonline.d k...
Has anyone experienced problems(/solutions) with the use of sockets with
Microsofts JVM. I have to use it to avoid
users having to download the Sun Java plugin. So I'm compiling with:
javac -target 1.1 foo.java
I'm simply trying to connect to the localhost:

socket = new Socket("127.0.0.1", port);

*Nothing* happens..no exceptions!

Kind regards - Jesper


I take it you are talking about an applet? Opening a socket connection to
localhost is not allowed from an applet running under normal security mode.
It should give you a security exception in either JRE though.

Silvio Bierman
Jul 17 '05 #2

P: n/a
[...]
I take it you are talking about an applet? Opening a socket connection to
localhost is not allowed from an applet running under normal security mode. It should give you a security exception in either JRE though.

[...]

Yes, sorry. I *am* talking about an applet. I was not aware that it is not
allowed to connect using the loopback address.
However, as you mention I haven't got any security exceptions from either of
the JVM's.
Thanks - Jesper
Jul 17 '05 #3

P: n/a

"Jesper Matthiesen" <jmatthiesen[_fjen_]@tiscali.dk> wrote in message
news:uo*********************@news000.worldonline.d k...
[...]
I take it you are talking about an applet? Opening a socket connection to localhost is not allowed from an applet running under normal security mode.
It should give you a security exception in either JRE though.

[...]

Yes, sorry. I *am* talking about an applet. I was not aware that it is not
allowed to connect using the loopback address.
However, as you mention I haven't got any security exceptions from either

of the JVM's.
Thanks - Jesper


An applet is only allowed to communicate to the server that served the HTML
page it resides on. Have you tried your applet from different workstations?
Are you running it from a browser or are you using an appletviewer?

Silvio Bierman
Jul 17 '05 #4

P: n/a
> An applet is only allowed to communicate to the server that served the
HTML
page it resides on. Have you tried your applet from different workstations? Are you running it from a browser or are you using an appletviewer?


Hi Silvio -
You were right! I was thinking that maybe the loopback could be seen as 'the
same machine' for test purposes even though we are actually making a
connection. However, I tried to catch the security Exception with:

catch(Exception e)
{
txt.append("Error: " + e + "\n");
}

but only

catch(SecurityException e)
{
txt.append("Error: " + e + "\n");
}

actually catches it (using Microsofts JVM). Shouldn't it be caught by the
first try+catch as well??
Thanks - Jesper


Jul 17 '05 #5

P: n/a

"Jesper Matthiesen" <jmatthiesen[_fjen_]@tiscali.dk> wrote in message
news:8y*********************@news000.worldonline.d k...
An applet is only allowed to communicate to the server that served the HTML
page it resides on. Have you tried your applet from different

workstations?
Are you running it from a browser or are you using an appletviewer?


Hi Silvio -
You were right! I was thinking that maybe the loopback could be seen as

'the same machine' for test purposes even though we are actually making a
connection. However, I tried to catch the security Exception with:

catch(Exception e)
{
txt.append("Error: " + e + "\n");
}

but only

catch(SecurityException e)
{
txt.append("Error: " + e + "\n");
}

actually catches it (using Microsofts JVM). Shouldn't it be caught by the
first try+catch as well??
Thanks - Jesper


I would have expected SecurityException to be an Exception. You could try
catching a Throwable since that would always catch any exception thrown.
Exception is a Throwable subclass.

Silvio Bierman
Jul 17 '05 #6

P: n/a
"> I would have expected SecurityException to be an Exception. You could try
catching a Throwable since that would always catch any exception thrown.
Exception is a Throwable subclass.


My point exactly. I haven't tried that yet, but SecurityException is indeed,
as you write, an exception. In Sun JVM v. 1.4.xx the security exception is
not thrown at all.
Regards Jesper

Jul 17 '05 #7

P: n/a

"Jesper Matthiesen" <jmatthiesen[_fjen_]@tiscali.dk> wrote in message
news:3I*********************@news000.worldonline.d k...
"> I would have expected SecurityException to be an Exception. You could try
catching a Throwable since that would always catch any exception thrown.
Exception is a Throwable subclass.


My point exactly. I haven't tried that yet, but SecurityException is

indeed, as you write, an exception. In Sun JVM v. 1.4.xx the security exception is
not thrown at all.
Regards Jesper


Have you in any way tweaked the settings of the Sun JVM to reduce the
security restriuctions?

Silvio Bierman
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.