Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Can't open socket to localhost (http://www.velocityreviews.com/forums/t125870-cant-open-socket-to-localhost.html)

Mark McKay 08-21-2003 10:34 AM

Can't open socket to localhost
 
I'm trying to set up a simple client/server pair of programs using
sockets, but am finding I can't establish a connection to the server
running on my localhost. When I execute:

InetAddress[] ia = InetAddress.getAllByName("localhost");
Socket sock = new Socket(ia[0], 8185);

I receive:

java.security.AccessControlException: access denied
(java.net.SocketPermission 127.0.0.1:8185 connect,resolve)
at java.security.AccessControlContext.checkPermission (AccessControlContext.java:269)
at java.security.AccessController.checkPermission(Acc essController.java:401)

What can I do to test my programs?

Mark McKay
--
http://www.kitfox.com

winbatch 08-21-2003 01:44 PM

Re: Can't open socket to localhost
 
Check your java.security file and make sure to give yourself the correct
permissions for socket connections.

"Mark McKay" <mark@kitfox.com> wrote in message
news:52de739f.0308210234.717fa2a5@posting.google.c om...
> I'm trying to set up a simple client/server pair of programs using
> sockets, but am finding I can't establish a connection to the server
> running on my localhost. When I execute:
>
> InetAddress[] ia = InetAddress.getAllByName("localhost");
> Socket sock = new Socket(ia[0], 8185);
>
> I receive:
>
> java.security.AccessControlException: access denied
> (java.net.SocketPermission 127.0.0.1:8185 connect,resolve)
> at

java.security.AccessControlContext.checkPermission (AccessControlContext.java
:269)
> at

java.security.AccessController.checkPermission(Acc essController.java:401)
>
> What can I do to test my programs?
>
> Mark McKay
> --
> http://www.kitfox.com




Tor Iver Wilhelmsen 08-21-2003 04:39 PM

Re: Can't open socket to localhost
 
mark@kitfox.com (Mark McKay) writes:

> java.security.AccessControlException: access denied
> (java.net.SocketPermission 127.0.0.1:8185 connect,resolve)


Do you use an applet loaded from another machine than localhost?

Mark McKay 08-21-2003 11:36 PM

Re: Can't open socket to localhost
 
Tor Iver Wilhelmsen <tor.iver.wilhelmsen@broadpark.no> wrote in message news:<usmnv7yod.fsf@broadpark.no>...
> mark@kitfox.com (Mark McKay) writes:
>
> > java.security.AccessControlException: access denied
> > (java.net.SocketPermission 127.0.0.1:8185 connect,resolve)

>
> Do you use an applet loaded from another machine than localhost?


No, they're both running on localhost. Eventually I'd like to have my
server running on a remote machine and my web applet to be downloaded
from that machine and connect back to the server. Is there a way to
do this without requiring my users to modify java.security?

Mark McKay
--
http://www.kitfox.com

John C. Bollinger 08-22-2003 01:56 PM

Re: Can't open socket to localhost
 
Mark McKay wrote:
> Tor Iver Wilhelmsen <tor.iver.wilhelmsen@broadpark.no> wrote in message news:<usmnv7yod.fsf@broadpark.no>...
>
>>mark@kitfox.com (Mark McKay) writes:
>>
>>
>>>java.security.AccessControlException: access denied
>>>(java.net.SocketPermission 127.0.0.1:8185 connect,resolve)

>>
>>Do you use an applet loaded from another machine than localhost?

>
>
> No, they're both running on localhost. Eventually I'd like to have my
> server running on a remote machine and my web applet to be downloaded
> from that machine and connect back to the server. Is there a way to
> do this without requiring my users to modify java.security?


The server from which the applet is loaded is the _only_ system to which
it can make a network connection without modification of the client's
security policy. It is possible that that is in fact related to the
problem you are experiencing -- normally applets are forbidden from
accessing most resources on the client machine, so it may be that your
VM is applying that restriction without noticing that the applet came
from the same machine.


John Bollinger
jobollin@indiana.edu



All times are GMT. The time now is 02:41 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.