Solved

Java security within a browser

Posted on 1998-02-16
3
162 Views
Last Modified: 2010-04-16
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
Comment
Question by:shaqshup
3 Comments
 
LVL 5

Accepted Solution

by:
fontaine earned 30 total points
ID: 1233071
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
 

Expert Comment

by:ashexpert
ID: 1233072
alternatively you need to have signed applets

and insted of CGI script sbetter alternative is servlets!
0
 

Author Comment

by:shaqshup
ID: 1233073
What are servlets? And how do you make signed applets? CAB files, or something else?
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question