Clean up of socket interface functions.