Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Sockets in Applets

  Asked By: Fern    Date: Jul 08    Category: Java    Views: 782

I am using Java SDK & Runtime 1.4.1. My problem is that when I ant to
connect to a host using Sockets it doesn't seem to work, but when I
run a normal application (same code) it works. What am I doing wrong?



1 Answer Found

Answer #1    Answered By: Jeffrey Washington     Answered On: Jul 08

You are most likely running into a java  security problem. An applet
is not able to use the resources of the system it is being run on
unless it is given permission to. Would you want some random applet
you load on a web page to gain access to your network or access files
on your machine without your permission? Of course not. This is why
Java restrict applets  to only doing things within the limits of its
security permissions. I haven't played with applets for quite some
time now, but I do remember having to fool around with certificates
and security permissions so that my applet could perform certain
functions on the system it is running on (ie opening sockets, reading
files, etc...).

Anyways, I'm pretty sure this is your problem  but I may be wrong  since
I haven't played with applets for some time now.

Didn't find what you were looking for? Find more on Sockets in Applets Or get search suggestion and latest updates.