[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

Java security within a browser

Hm... I am pretty new to java. I was pretty much surprised after a couple of days of work to find out that simple

Socket s = new Socket ("somewhere.com", PORT);

doesn't work!!! Neither IE nor Netscape. The latter throws a security exception, and the former one just gets stuck! Don't tell me I can't create a socket when running an applet form a browser?!?!?!

Is there a way to solve this?
0
shaqshup
Asked:
shaqshup
1 Solution
 
fontaineCommented:
You can only open a socket to the machine that has served your applet. That's the rule. So, if your applet comes from A.com, you can't open a socket to B.com.

The only work-around is at the server-side. For example, write a CGI script that opens the stream for you and forward it to your applet.
0
 
ashexpertCommented:
alternatively you need to have signed applets

and insted of CGI script sbetter alternative is servlets!
0
 
shaqshupAuthor Commented:
What are servlets? And how do you make signed applets? CAB files, or something else?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now