Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Can't open socket to localhost

Reply
Thread Tools

Can't open socket to localhost

 
 
Mark McKay
Guest
Posts: n/a
 
      08-21-2003
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
 
Reply With Quote
 
 
 
 
winbatch
Guest
Posts: n/a
 
      08-21-2003
Check your java.security file and make sure to give yourself the correct
permissions for socket connections.

"Mark McKay" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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



 
Reply With Quote
 
 
 
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      08-21-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (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?
 
Reply With Quote
 
Mark McKay
Guest
Posts: n/a
 
      08-21-2003
Tor Iver Wilhelmsen <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> (E-Mail Removed) (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
 
Reply With Quote
 
John C. Bollinger
Guest
Posts: n/a
 
      08-22-2003
Mark McKay wrote:
> Tor Iver Wilhelmsen <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
>
>>(E-Mail Removed) (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
(E-Mail Removed)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit Ring server to localhost only. RingFinger.new('localhost')apparently doesn't work koicat Ruby 0 07-02-2010 08:01 PM
change from "//localhost:numbers/" to just "//localhost/"? =?Utf-8?B?S2VuTGVl?= ASP .Net 5 02-12-2006 05:14 AM
Localhost isn't localhost EdwardH Java 20 10-01-2005 12:08 AM
Can I Reset the Root from localhost/myproject/ to localhost/ Alex ASP .Net 4 02-08-2005 01:45 PM
HttpModule -- how to intercept urls like http://localhost/abc/def or http://localhost/abc/def/ where abc, def are non virtual dir Jiong Feng ASP .Net 0 11-19-2003 05:29 AM



Advertisments