delete socket function