Android : How to define the communication between groups of clients and the server?

on Saturday, September 13, 2014


I'm writing an Android app that communicate with a server through sockets. The app is a multiplayer game which send messages (Strings in Java) as JSON through those sockets. To initiate a game, I create a "Group" object which contains "player" objects. The group has a ServerSocket object which is moved on to the "player", and each device communicate with its server instance "player". The computation and communication between the devices is done in the "Group" object.


My problem is that for creating a "Group" I need a ServerSocket which runs on a port. So as I see it, for each group I need a different port. The number of ports is limited in the server and I believe working with ports is not the best way.


Is there any other way to implement the communcation described above?


0 comments:

Post a Comment