Moved standalone socket funcs to own module.