Results 1 to 2 of 2
  1. #1
    Waccoon is offline Member
    Join Date
    Dec 2007
    Location
    MA, USA
    Posts
    2
    Rep Power
    0

    Question Socket refused, but applet talking to native server

    Hi, everyone. I've got a real hair-puller on my hands.

    I've been having an odd problem with an old applet and socket connections with Java v6. I've read that applets do not need to be signed to connect to servers from which the applet was downloaded. However, since Java v6 was released, some servers have been throwing this permission error:

    access denied (java.net.SocketPermission <IP ADDRESS>:80 connet, resolve)
    This doesn't make sense. If the applet is downloaded from "www.mysite.com" and the applet is trying to open a socket on "www.mysite.com", this shouldn't result in a permission error, should it?

    What really confuses me is that this only happens on some servers but not others, which would suggest a server problem, but only Java v6 is causing the applet to complain, so it has to be a client problem (or both). I can't seem to find any real pattern as to which servers will have the issue and which will not. It doesn't seem to make a difference whether the web host is free or commercial.

    Java Code:
    URL url = new URL(getCodeBase(), p("url_save", "picture.cgi"));
    int k = url.getPort();
    socket = new Socket(url.getHost(), k <= 0 ? 80 : k);
    The code fails on the call for a new socket, so it has nothing to do with writing to the socket. The applet also supports "url.openConnection()" as an alternative, but this also fails with the same SocketPermission error when trying to connect.

    The applet is designed to be redistributable, so I do not have a "codebase" defined in my HTML.

    I have access to a server that returns the error, so I can test code changes. Is it possible that getCodeBase() can fail in some cases? Does anyone know what might have changed in Java v6 that would suddenly cause this issue to show up, while Java v5 works fine? Is there some special security initialization that needs to happen before a socket is opened? I didn't see anything in the socket tutorials I've been researching.

    I know little about Java, but my PHP script is dependent on this applet, so I need to figure out what's wrong. The applet author lives in Japan and I've had no luck contacting him for the last year, so I can't get help that way.

  2. #2
    Waccoon is offline Member
    Join Date
    Dec 2007
    Location
    MA, USA
    Posts
    2
    Rep Power
    0

    Thumbs up Possible bug in Java 1.6.0

    Well, it appears I've found my answer.

    A problem has been discovered in the Firefox version of Java 1.6.0_03

    If you know anyone who is having issues with a Java applet using 1.6.0_r3, please let them know about this.

    Although only some servers are affected by this issue, I can confirm that all the affected servers I've tested WILL work with Internet Explorer and Opera using the same version of Java. Apparently, only Firefox is affected.

    I will also test Safari and Firefox on my old Mac to see if the OSX version of Java has this issue as well.

    I guess this will teach me to use different browsers when testing for Java applet compatibility, and not just HTML layout.

Similar Threads

  1. Server socket - send image to client
    By Hinty in forum Networking
    Replies: 2
    Last Post: 03-14-2009, 07:39 AM
  2. Replies: 2
    Last Post: 10-05-2008, 06:13 PM
  3. (Server)Socket application deploying
    By mdinant in forum Networking
    Replies: 0
    Last Post: 04-09-2008, 05:10 PM
  4. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 09:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •