This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes why use raw sockets for online multiplayer games Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "why use raw sockets for online multiplayer games" Watch "why use raw sockets for online multiplayer games" New topic

why use raw sockets for online multiplayer games


Joined: Jul 08, 2002
Posts: 2
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

Joined: Jul 14, 2002
Posts: 7
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.
GeeCON Prague 2014
subject: why use raw sockets for online multiplayer games