Jump to content
  • Advertisement


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


[java] Two Printwriters and Two BufferedReaders in only one socket

This topic is 5857 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

I´m doing a multiplayer game, and because of the nature of the game (it''s a card game, turn-based, and anyone can chat at anytime), I need two streams for each socket the player opens, one for the game operations, and another for free chat. I could create two sockets for each player, but it''s cumbersome (I think) and reduces the server capacity in a half. Is there a way to create two streams from a single socket? :D Thnx for your replies Mac for productivity Linux for development Palm for mobility Windows... for the Solitaire

Share this post

Link to post
Share on other sites
There is no way to get two streams from a socket.

What you should do, instead, is encapsulate the chat messages in the game protocol. That''s what pretty much every game out there does already...

You must already have several kinds of move messages in the game protocol.. Just add another message which means "this next block of text (delineated by newlines, or something similar) is a chat message."

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!