Link to home
Start Free TrialLog in
Avatar of gf3
gf3

asked on

Send Data to Specific Thread

Ok,I have a program that needs to spawn many threads. The problem is afterwards i need to send some data to only certain threads, not all of them. Or i need to be able to tell the thread to execute a certain method. I have references to all the threads stored in a vector. How can I accomplish this? Thanks in advance,

gf3
gf3@bm3.org
Avatar of Tommy Braas
Tommy Braas
Flag of Australia image

Could you describe what it is you're trying to accomplish with this? What is the overall problem you're trying to solve?
Avatar of gf3
gf3

ASKER

I'm making an AWT based chat application. It isn't a channel based application, it's p2p (so kinda like a one-on-one type of thing). When the user opens a chat with someone a new window (or frame) is started in a new thread and a reference is put in a Vector so i can kepp track of them all. I need to know how to send data the certain threads when the client receives data from the server. Or i need to be able to tell the specific thread to execute a certain method to retreive the data from somewhere. Is there any way of doing this?
It sounds like you need to solve two different problems. One is a connection to the server, and the other is the P2P connection between chat participants. If the P2P part is only for 1:1, then it is really easy, if it is for 1:n it becomes a little bit trickier. Is my assumption correct?
Avatar of gf3

ASKER

Well it is 1:n, but what do you suggest?
I would create a class which handles client requests to the server (which it sounds like you pretty much have right now). Then you would need to create a P2PClient which is capable of communicating with another P2PClient. Are you using TCP or UDP for the network communication?
Avatar of gf3

ASKER

I'm using TCP, but unsigned applets can only connect to the server that they were spawned off of... so the server has to handle all networking between clients.
ASKER CERTIFIED SOLUTION
Avatar of Tommy Braas
Tommy Braas
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial