Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
Author

why use raw sockets for online multiplayer games

raman
Greenhorn

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

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why use raw sockets for online multiplayer games