Refactoring - all socket methods managed by a client/server flag instead of calling individual methods for client and server