Are there any good Java networking tutorials? I'm doing a side project (for a game), and I'm planning on using Java for the server and C++ for the client.
I've decided to do this because I'm starting to dislike C++ for Server-side applications, and I'd figure Java's more fit for the job.
What are your project specs? Java has support for both synchronous and asynchronous models
Pretty much it needs to handle multiple clients at a time, and I'm looking for the asynchronous model. The server needs to be real-time, as it's for a game.
My server is going to be designed as such -
I have 4 threads. 1 thread receives packets, it decides whether the packet is a duplicate or not based on it's time stamp and header. Then it adds it to a queue. Second thread handles the packets, and when it's done it pops them off the queue. If it needs to, it adds response packets to a send queue. The 3rd, main thread receives input from the server operator, and if it needs to, puts packets on the send queue. The 4th thread sends the packets on the send queue out to the clients.
You could probably consolidate your 3 networking threads into 1 by going with the async model. A single thread should be able to handle many more than 4 connections without even breaking a sweat.