Search code examples
javasocketsserverclient

Client server best practice java


In a simple game development is it better to have the server handle most of it or to have the client handle do it?. For instance a simple hangman game. Have the client sent over the letter and the server handle the calculations and send back the hit or miss + 'blanked out string'. or to have the server send blank string and do the comparison on the client side. What are the best practice in terms of socket programming.


Solution

  • See there are two kinds of network-based programs:

    1. Pure network-based: Display on client-side and everything else on the server.
    2. Standalone: Database and Model on server and controller and display on client-side. Resources are also present on the client-side.

    In terms of socket programming, I would prefer Pure network-based apps. You should consider the memory and time complexity in both the ways and then choose the best one.