socket boilerplate code for games