I've designed two windows as standalone applications in swing for the client-side & a servlet for the server side.The first window is named as Login window & second as MainWindow. Now when the user logins using my Loginwindow the user gets authenticated through my Loginservlet .If the required parameters for authentication are successfully verified then my Mainwindow code is called from the Login window.
The connection between Login window & LoginServlet is done using HttpTunneling.
My Mainwindow consists of a textarea. I want to display the names of users currently logged in that textarea.
I've made a jar for this whole thing named as login .jar.
In my first approach when only one single user logs in then I'm able to print his name in the textarea.But,when some other user executes this jar from another command prompt(for e.g) & logs in then only the second users name gets displayed in the textarea .
In my second approach when all the users logins using the same login window when first time the jar was called & was never exited(the jar) then all the users currently logged in are visible in the textarea.
In my first case i'used a simple array while in my second case i used a static counter for my array in my separate plain java class which i made for adding the users name in the array .
But what i need is that when different- different users logs in from their individual machines using their own individual login window then also each user should be able to see the names of the users currently logged in, in their own Mainwindows'.
So how to approach for the above mentioned thing .
Thanking you, Jignesh
The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Joined: Dec 28, 2004
Please help me out if anybody has even a small idea regarding my query. Its very important for me......
You are going to have to somehow pole the server every so often to find out who is logged in OR you are going to have to use a ServerSocket and have everyone's MainWindow listen and when another user logs in, send out some sort of UDP Broadcast on the network that says someone new logged and then let the MainWindow ServerSocket listen for that and do whatever with it. The only real issue I can think of is if users are on different subnets and your gateway has disabled UDP Broadcasts which is pretty common.
It's a pretty common chat program issue. There are tons of discussions on this board. More specifically in the Sockets and Internet Protocals forum. There are also a ton of example chat Swing applications if you google for them.
Thanks for the reply sir. But i really forgot to provide in my query that no scoket programming is used or is to be used. I've to make it happen using HTTP only .So how to approach in that context. Please reply as soon as possible.