This week's book giveaways are in the Cloud/Virtualization and Go forums.
We're giving away four copies each of Cloud Native Transformation: Practical Patterns for Innovation and The Go Workshop and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native Transformation: Practical Patterns for InnovationE this week in the Cloud/Virtualization forum
or The Go Workshop in the Go forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

live website chat application!

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I want to make a live chat service for the website. Now, that i'm new to java, to start with i tried to run a chat application that i got from the search link.

http://www.cn-java.com/download/data/book/socket_chat.pdf

I'm using jdk 1.5_07 and an appletviewer to view my client applet.

The application consists of chat server, server thread ,chatclient and a clientapplet that uses a server socket on server side to listen the requests from clients n a socket on client side to connect to serversocket n threads for each user.Its a multiclient chat application.



The chat server is working fine.

But the chat client is working fine if client and server r run on the same local machine.

The client is also running fine on one of the systems in the LAN.


For rest of the systems chat clients is generating the following error:


error:

java.security.AccessControlException: access denied (java.net.SocketPermission 1
92.168.0.18:5000 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:264)
at java.security.AccessController.checkPermission(AccessController.java:
427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
at java.net.Socket.connect(Socket.java:510)
at java.net.Socket.connect(Socket.java:466)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:179)
at Client.<init>(Client.java:40)
at ClientApplet.init(ClientApplet.java:18)
at sun.applet.AppletPanel.run(AppletPanel.java:378)
at java.lang.Thread.run(Thread.java:595)



I feel this is some kinda security check automatically performed by the jdk 1.5 as a result of which my client socket cannot get the access to server ip address.To fix this error, i even tried applying policy on the server side..but still its not working.

I'm using jdk 1.5_07 and an appletviewer to view my client applet.

Can anybody please tel me what can be done to resolve this issue. Since I'm new to this java world n this being my first live application...any help would be appreciated.

Can u also tell me the best technology that can be used to make a live chat application on website.

Thanks in advance.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chat server/clients are very easy to write on your own.

Create a server using java.net.ServerSocket. Create a client using JApplet that uses java.net.Socket to connect to ServerSocket. Have the server fork a Thread for each connected client. And any Strings from the ServerSocket InputStream go the clients OutputStream. Any Strings from the client's OutputStream go to the servers InputStream, very simple.
 
I do some of my very best work in water. Like this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!