Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why use raw sockets for online multiplayer games

 
raman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am trying to build a multiplayer online game in applets. i would like to know why do we make the server application which accepts connections on a specified port, when we can simply make the server application in servlets/jsp. By making raw sockets, we restrict our game to be played behind a firewall.
Should i design my own protocol for transmitting messages between client and server. Can i communicate with XML Or can i use JAXM or anything else?
What would be the best solution?
 
Trever Shick
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The limitation with a servlet solution is that the connection is one way from client to server. Thus, your client would need to "poll" the server for updates.
if you use a regular socket connection, then the communication between client and server can be handled asynchronously. Meaning the server can push data to the client without the client first requesting it...
That's the difference. Using Servlets would work, but it will not be acceptable for online games that require quick response as you'd have to poll the servlet too much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic