Solved

How do socket communicate with host by applet?

Posted on 2001-06-20
4
203 Views
Last Modified: 2010-04-16
I have meet a problem following that recentainly:  
   Why can't the client send the message to server in UDP programing When I use applet and frame ?
   There are the following error in java control:
//************************************************//
com.ms.security.SecurityExceptionEx[JIMMessage.feedback]: cannot access 6767
   at com/ms/security/permissions/NetIOPermission.check
   at com/ms/security/PolicyEngine.deepCheck
   at com/ms/security/PolicyEngine.checkPermission
   at com/ms/security/StandardSecurityManager.chk
   at com/ms/security/StandardSecurityManager.checkListen
   at java/net/DatagramSocket.create
   at java/net/DatagramSocket.<init>
   at java/net/DatagramSocket.<init>
   at JIMMessage.feedback
   at JIMEnter.actionPerformed
   at java/awt/Button.processActionEvent
   at java/awt/Button.processEvent
   at java/awt/Component.dispatchEventImpl
   at java/awt/Component.dispatchEvent
   at java/awt/EventDispatchThread.run
com.ms.security.SecurityExceptionEx[JIMMessage.feedback]: cannot access "192.168.0.3":6767
   at com/ms/security/permissions/NetIOPermission.check
   at com/ms/security/PolicyEngine.deepCheck
   at com/ms/security/PolicyEngine.checkPermission
   at com/ms/security/StandardSecurityManager.chk
   at com/ms/security/StandardSecurityManager.chkex
   at com/ms/security/StandardSecurityManager.checkConnect
   at java/net/DatagramSocket.send
   at JIMMessage.feedback
   at JIMEnter.actionPerformed
   at java/awt/Button.processActionEvent
   at java/awt/Button.processEvent
   at java/awt/Component.dispatchEventImpl
   at java/awt/Component.dispatchEvent
   at java/awt/EventDispatchThread.run
Exception occurred during event dispatching:
com.ms.security.SecurityExceptionEx[JIMMessage.feedback]: cannot access "192.168.0.3":6767
   at com/ms/security/permissions/NetIOPermission.check
   at com/ms/security/PolicyEngine.deepCheck
   at com/ms/security/PolicyEngine.checkPermission
   at com/ms/security/StandardSecurityManager.chk
   at com/ms/security/StandardSecurityManager.chkex
   at com/ms/security/StandardSecurityManager.checkConnect
   at java/net/DatagramSocket.send
   at JIMMessage.feedback
   at JIMEnter.actionPerformed
   at java/awt/Button.processActionEvent
   at java/awt/Button.processEvent
   at java/awt/Component.dispatchEventImpl
   at java/awt/Component.dispatchEvent
   at java/awt/EventDispatchThread.run
//**********************************************//
If you can tell me,I would send all my points!Thank you!

0
Comment
Question by:coffeetea
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
tonus earned 50 total points
ID: 6209724
Applet can communicate only to the server from which it is loaded. Because of client side security features, You are not allowed to access any other resources from the applet.
   Otherwise you have to grant permissions in the client side by manipulating the policy file located at
C:\Program Files\JavaSoft\JRE\1.3.0_02\lib\security\java.policy (if the browser uses jre plug-in) or you got sign the applet.
0
 

Expert Comment

by:sobhan_genie
ID: 6213669
What tonus said is correct I guess in addition to it these are the lines u have to add in the java.policy file

// allows anyone to listen on un-privileged ports
permission java.net.SocketPermission "localhost:1024-, "listen";

              This says on local host applets can listen on to any ports >= 1024. If you want it to be only 1024 then remove the - suffix.


// allows anyone to listen on un-privileged ports
permission java.net.SocketPermission "172.20.34.148:1729", "listen,accept,connect";

            The same thing above if you are about to access a remote machine you have to do this.

             Hope this helps.
bye,
Sobhan

0
 

Author Comment

by:coffeetea
ID: 6215073
Thank for your answer!I'll send all my points to you!
But now I have 70 points only,so I'm about to send 50 points to tonus ,and I'll send another 50 points to
sobhan_genie later!Thanks!
0
 

Author Comment

by:coffeetea
ID: 6230058
Dear sobhan_genie :
   I have 50 points,but I don't know how to send to you!
It's seemed that there is no way to send points again!  
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
recursion example 16 124
tomcat administrtor 12 46
hibernate example issues from command prompt 10 40
How to determine if a string is a valid SHA value 7 28
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now