Advertisement

Threaded Server

Started by May 16, 2000 05:48 PM
1 comment, last by Dan Smith 24 years, 6 months ago
How do you communicate between threads on a server? I have a server that accepts threads and echos the data back now. However I dont know how to communicate with the other threads, such as to send messages to one IP. Has anyone done something like this, and if so, how? -Dan
D. Smith
Threads share the same address space so the easiest way to communicate between threads is altering common objects. Just remember to wrap the accesses to the objects with mutexes, semaphores, critical sections, or whatever else is apropriate.
Advertisement
ah, well if you had the foresight to use Java (servlets or even clients (applets)) :p , you could make a persistent serialized object which can be parsed or even picked up by (any number of) threads (local or remote), and even (if your brave) point the object @ a database (kinda like Apache::Session (perl/CPAN)) for storage/security (which is nice ).

This topic is closed to new replies.

Advertisement