Chat system through applet, accessing applet from server and local host...
843811Aug 2 2005 — edited Aug 3 2005Thanks in advance for concerns my problems......
I m woking on chat system by using java swing applet. It is working well on the local machine (it means on single machine) coz my application is accepting the IP of the same system and openning the socket of the same system by host and ofcourse client is also connecting to the same system.So, there is no problem in communication.
But as i put my application on server and try to access the application through different system. It means host is accessing the application from different system and client is also accessing the application from other system. Now both r distinguish by there own system. Now wat is happenning here ---------
1). If i put the IP of the server on my application that is store on the same system (server). it does not show any error but it does not connect to the host. Host is accessing the application from the server but openning the socket of their own system. and on the other hand, client is accepting the IP of the server,it does not get any open socket. So, is there any way to redirect the client to the host where the socket is open and ofcourse that should all done by server.
But mind it i could not use servlet here coz this site is running on .net platform , means we can only pest our applet on html page.
2). Now if i change the scenerio, i put the IP of the host on my application, and the host is accessing the same application from the server and client is also accepting the IP of the host and accessing the application from the server. Its show an error such as
java.security.AccessControlException: access denied (java.net.SocketPermission www.*****.com:1234 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
wat i get from this error that it is voileting the properties of applet. Applet can only accessing from the server not from the other system. We can only connect to server where the applet is stored.
i ve followed these steps mentioned below :
1). Steps for the Code Signer
1) create a jar file Containing the class file.
2) Generate keys by using keytool command.
3) Sign the JAR File by using jarsingner tool
4) Export the public key Certificate
2) Steps for the Code Receiver
1) Import the Certificate as a Trusted Certificate
2) SetUp a policy File to Grant the Required Permission
3) Set up the Policy File to Grant the Required Permission
4) See the Policy File Effects
My policy.java file is somting like that ..........
keystore "http://www.nameofsite.com/chat/nirajstore";
grant signedBy "niraj", codeBase "http://www.nameofsite.com/chat/*" {
permission java.io.FilePermission "http://www.nameofsite.com/chat/Images/*", "read";
permission java.net.SocketPermission "www.nameofsite.com/chat/talkDimensionChat", "resolve";
permission java.net.SocketPermission "192.168.1.198:1234", "connect, resolve";
};
every thing is done well...... means i was feeling proud to completed it successfully....
But still worried, because still it is not working well, this time it is not showing any error but not working properly..
The chat system r not exchanging message...even they r not connect with each other,,,,
Probably i ve done some mistake somewhere else.
Plz suggest me according to ur experience, as u might be done earlier...
the problem is, it is working well on local system in which it is stored but not on client- server architecture.
wat is the way to run our applet by using URL http://www.somename.com/ , so that our socket ll run on this architeture...withour throughing any exception.
Still i m working hard..... to find the solution.....
Could it be possible that i can ve ur contact number or home address(or some other address where u feel comfortable to meet) so that we can face to each other and can disscused properly and as soon as possible solve our problem.. trust me i would not be spend ur time lot.
Suggest me soon ........
waiting 4 ur reply
Thanks and regards
Niraj Kumar Singh
+91 9891076929 / +91 9891072760