Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in ChatServer Applet using ServerSockets  RSS feed

 
sri dhar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello EveryBody,
Let me first explain my problem.
I have developed Chat Application Using ServerSocket and Socket.
I have an Applet Chat Server which is called ChatServer which the server which serves the Applet client Applet.
Im have deployed both the ChatSErver applet and Chat Client applet emebedded in an HTML.
So that The Chat administrator can access it from any where .
Is this correct ? pls let me know. Im getting this exception in the ClientApplet
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at DhanishClient.startClient(DhanishClient.java:106)
at DhanishClient.initComponents(DhanishClient.java:77)
at DhanishClient.init(DhanishClient.java:23)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
DO i have to give policy permmision in tomcat.
IS THIS WAY FIRST OF ALL RIGHT FOR CHAT SYSTEM.
PSL LET ME KNOW
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although you are showing a ConnectException rather than a SecurityException, I'm willing to bet that you're running into the applet sandbox. Especially if you are really trying to realise the server as an applet.
All an (unsigned) applet can do is connect back to the server it came from (ie Tomcat). It cannot connect a server anywhere else. It cannot open server sockets accepting connections from G-d knows where. I'm willing to bet that if you log exceptions more carefully you'll see security exceptions all over the place.
Use servlets, HTTP request and polling to implement your server on Tomcat.
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!