I read that a server process with an xxxx port can be for more than concurrent executions, but then how doesn the player session differentiate the game session when connecting to get his status to active?
As far as I understand, a port should only be used for one server process at a time. Yes, you can have multiple instances of a server process configured in your fleet settings to be run concurrently. However, in that case, there is some server logic to check whether or not a port is in use or not in order to prevent multiple server processes to be run on the same port. You can check this link out for more information on that, How do ports get handled when running multiple server processes per instance?.
With that said, when a player is connecting to a server process, the player should pass their player session id and player id, according to this documentation article, so that the server can properly authenticate the incoming connection. If the the player session id is valid, then the connection will be accepted and the player session associated with that id should be accepted. The player session acceptance logic has to be coded in your game server and the passing of the player session id when connecting to the server has to be coded in your game client.
As @chrisgong you can add whatever custom logic required to validate the incoming player but its recommended that you get the player session id from the connecting player so you can validate the session AcceptPlayerSession
See here for the rough call sequence: https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api-interaction-vsd.html
Note: You don’t have to use player sessions in GameLift but they are recommended. You can also get the game session ip and port also from DescribeGameSessionDetails as they are properties of the game session itself.
Hi pip thank you for replying, maybe i havent to clear with my question but what i meant was for example i got 2 gamesession, with both having the same IP and the same Port, and my Player1 want to connect to 1 of the gamesession that hold his playersession, how does the player1 know which one to connect when they have same port and IP since we are connecting and searching server using ip and port only, how does player 1 differentiate the socket he need to connect? and can you give example for the Algorithm of the custom logic that can be implemented?
Each GameSession needs to be on its own port otherwise things will get confusing fast.
You assign the port on the ProcessReady call. This says this process on this port is ready to host a game session.
Do you have a scenario/use case where you need multiple game sessions on the same port?