Socket update

Added some functions and cleaned the debug.