How do i connect my game to the server?

can anybody recommend me any library or method to connect the game to the server like Hayday(Supercell) and JungleHeat(My.com) had done with there games ?
Ex.
GAME ---->request(authnication)----->SERVER
GAME <-----respond(success/failure)<----SERVER