Forums Register Login

chat room application

+Pie Number of slices to send: Send
I have this chat room application where in multiple clients can chat simultaneously. How do i make it a one to one chat application ?

This is server program.


+Pie Number of slices to send: Send
 

akila sekaran wrote:I have this chat room application where in multiple clients can chat simultaneously. How do i make it a one to one chat application ?
This is client program...


Akila,

1. That is a vast amount of code to go through. Can you localize your question a bit? What have you tried?
2. I've shortened some lines and broken up one because they're too long. Please re-read the UseCodeTags page thoroughly before you post new code or edit this.

Winston
+Pie Number of slices to send: Send
 

Winston Gutkowski wrote:

akila sekaran wrote:I have this chat room application where in multiple clients can chat simultaneously. How do i make it a one to one chat application ?
This is client program...


Akila,

1. That is a vast amount of code to go through. Can you localize your question a bit? What have you tried?
2. I've shortened some lines and broken up one because they're too long. Please re-read the UseCodeTags page thoroughly before you post new code or edit this.

Winston



hi,
Okay as you said i have removed client class which had no purpose here.. here i am using a arraylist to process multiple clients. my question is how do i modify this program to have just two people chatting among themselves?
+Pie Number of slices to send: Send
Find the part of the code which allows the server to handle more than one client. Then modify that code so it only handles one client.
+Pie Number of slices to send: Send
 

akila sekaran wrote:Okay as you said i have removed client class which had no purpose here.. here i am using a arraylist to process multiple clients. my question is how do i modify this program to have just two people chatting among themselves?


Well I'm no expert on this stuff, but if you already have your app working (and I hope it's using Lists, not ArrayLists, BTW; and if it isn't, get that fixed first), just create a List class of your own that can take a limit (ArrayList isn't final, so you could just extend it), and doesn't allow any more elements to be added after that.
Then, your "single" chat just applies a limit of 1 (or 2, depending on how it's used) to the Client List.

Winston
+Pie Number of slices to send: Send
 

Winston Gutkowski wrote:

akila sekaran wrote:Okay as you said i have removed client class which had no purpose here.. here i am using a arraylist to process multiple clients. my question is how do i modify this program to have just two people chatting among themselves?


Well I'm no expert on this stuff, but if you already have your app working (and I hope it's using Lists, not ArrayLists, BTW; and if it isn't, get that fixed first), just create a List class of your own that can take a limit (ArrayList isn't final, so you could just extend it), and doesn't allow any more elements to be added after that.
Then, your "single" chat just applies a limit of 1 (or 2, depending on how it's used) to the Client List.

Winston




thanks for the reply. I have written a new simple one.
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5160 times.
Similar Threads
Problem with pass-by-reference ?
Very New (obviously) - Program terminates
Multithread-call center support
Integer cannot be cast to client
Failed to obtain specified collection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:12:29.