Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dan Smith

Threaded Server

This topic is 6911 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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 ).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!