Solved

How do socket communicate with host by applet?

Posted on 2001-06-20
4
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

690 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