Making socket API slightly more consistant