Writing a game server in java


















Matcher ; import java. Methods: java. Socket getInputStream Returns an input stream for this socket. Socket getOutputStream Returns an output stream for this socket. Methods: write byte [ ] b , int off , int len.

Methods: read byte [ ] b , int off , int len. If we send "abcdef", we get these bytes: - FIN Is this the whole message? Full list of Opcodes - If the second byte minus is between 0 and , this is the length of the message. Note: I can take because the first bit is always 1. Writing WebSocket servers. I also couldn't find a paper that describes how it should work.

Meanwhile, I'd like to gather your opinions and see how you would handle some things so I can learn how to write a server correctly. Here are a few questions off the top of my head: may be more will come First, let's define what a server does. It's primary functionality is to hold TCP connections with clients, listen to the events they generate and dispatch them to the other players. But is there more to it than that? Should I use one thread per client?

Isn't that too much? What hardware is needed to support that? And how much bandwidth does a lobby consume then approx? What kind of data structure should be used to hold the clients' sockets? How do you protect it from concurrent modification eg.

Is ConcurrentHashMap the correct answer here, or are there some techniques I should know? When a user enters the lobby, what mechanism would you use to transfer the state of the lobby to him? And while this is happening, where do the other events bubble up?

Input is greatly appreciated. Mich Robinson wrote: I'd have a good long think about whether your software will offer anything different from the various chess servers already on the internet - if it doesn't then you're going to be spending a long time writing something that no-one will use.

Forum: Game Development. How to write a lobby game server. Optional 'thank-you' note:. So I'm writing a Chess matchmaking system based on a Lobby view with gaming rooms, general chat etc. Remember me. Forgot password? Don't have a GameDev. Sign up. Email Address. Careers Careers. Learn about game development. Follow Us. Chat in the GameDev.

Back to Networking and Multiplayer. Writing a server in Java. Networking and Multiplayer Programming. GenmaC I need some info on this idea. How well does Java handle large player loads, and general server stuff like multiple clients and so forth?

I know Java, but I''m curious if it would make a decent server. Examples from actual projects would be nice. Cancel Save.



0コメント

  • 1000 / 1000