Solved

How do socket communicate with host by applet?

Posted on 2001-06-20
4
196 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

747 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

12 Experts available now in Live!

Get 1:1 Help Now