• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Connect to a socket server using applet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm coding a socket program using VaJava 4.0.
I met a problem which was that I could't establish the connection between the socket server and the client that was an applet. I have been successfully running the server to listen, but when I used "new Socket(host, port)" to get a socket instance, an AccessControlException was thrown, which was associated with a SecurityPermission object. Then I assigned the previlege by calling function AccessController.doPrivileged, but it didn't work. Would you please help me? Thank you!
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are serveral steps. First of all you need to sign your applet. This will based on what kind JVM you support in your browser side:
1. If use Microsoft VM, you need to sign your applet as a CAB file. In your code, you need to add following code before you make any network calls: PolicyEngine.assertPermission(PermissionID.NETIO);
You will need SDK tools: "makecert", "signcode"
2. If use Sun's JVM, make sure it is signed as JAR files. You will need "keytool" and "jarsigner".
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic