Clean up socket communication