Shutdown read-half of the socket connection;
517711
protected void shutdownInput() throws IOException {
      if (fd != null && fd.valid()) {
          socketShutdown(SHUT_RD);
          if (socketInputStream != null) {
              socketInputStream.setEOF(true);
          }
          shut_rd = true;
      }
    }
590158
def _shutdown_transport(self):
        """"""
        if self.sock is not None:
            try:
                unwrap = self.sock.unwrap
            except AttributeError:
                return
            try:
                self.sock = unwrap()
            except ValueError:
                # Failure within SSL might mean unwrap exists but socket is not
                # deemed wrapped
                pass
1279388
def stop(self):
        """"""
        self._stopped = True
        threads = [self._accept_thread]
        threads.extend(self._server_threads)
        self._listening_sock.close()
        for sock in list(self._server_socks):
            try:
                sock.shutdown(socket.SHUT_RDWR)
            except socket.error:
                pass

            try:
                sock.close()
            except socket.error:
                pass

        with self._unlock():
            for thread in threads:
                thread.join(10)

        if self._uds_path:
            try:
                os.unlink(self._uds_path)
            except OSError:
                pass
691168
public final void shutdown() throws IOException {
    if (this.shutdown) {
      return;
    }
    this.shutdown0();
    this.shutdown = true;
    this.connector.shuttingDown();
    this.connector.quitAllSessions();
    this.connector.stop();
    this.memcachedHandler.stop();
    XMemcachedMbeanServer.getInstance().shutdown();
    if (AddrUtil.isEnableShutDownHook() && !this.isHutdownHookCalled) {
      try {
        Runtime.getRuntime().removeShutdownHook(this.shutdownHookThread);
      } catch (Exception e) {
        // ignore;
      }
    }
  }
1126501
def _close_connection(self):
        """"""
        if (self._mode == PROP_MODE_SERIAL):
            self._serial.close()
        elif (self._mode == PROP_MODE_TCP):
            self._socket.close()
        elif (self._mode == PROP_MODE_FILE):
            self._file.close()
684520
@Override
    public void shutdown() {
        synchronized (connections) {
            parent.channelCloses(this);
            for (final MessageInbound connection : connections) {
                try {
                    connection.getWsOutbound().close(0, null);
                } catch (final IOException e) {
                    LOG.error("Connection [" + connection.toString() + "] can't be closed.", e);
                } finally {
                    final ExecutorService executorService = connectionThreads.get(connection);
                    if (executorService != null) {
                        executorService.shutdown();
                    }
                    connectionThreads.remove(connection);
                }
            }
            connections.clear();
        }
        callback = null;
    }
168891
def pub_close(self):
        '''
        
        '''
        if hasattr(self._sock_data, 'sock'):
            self._sock_data.sock.close()
            delattr(self._sock_data, 'sock')
440485
def halt(self):
        """"""
        self.log.warning('Halting connection to AVR')
        self._halted = True
        if self.protocol.transport:
            self.protocol.transport.close()
401955
def close
      if @sock and not @sock.closed?
        begin
          @sock.shutdown(Socket::SHUT_WR) rescue nil
          orig, self.read_timeout = self.read_timeout, 3
          @sock.read rescue nil
        ensure
          @sock.close
          self.read_timeout = orig
        end
      end
    end
1321915
def shutdown_wr(self):
        
        if self._sock_send is not None:
            self._sock_send.close()
        else:
            return self.shutdown(socket.SHUT_WR)
791622
def _shutdown(self):
        """"""
        if self._channel:
            _log.info("Halting %r consumer sessions", self._channel.consumer_tags)
        self._running = False
        if self._connection and self._connection.is_open:
            self._connection.close()
        # Reset the signal handler
        for signum in (signal.SIGTERM, signal.SIGINT):
            signal.signal(signum, signal.SIG_DFL)
424792
def shutdown(self):
        """"""
        if self.ZMQcontext and not self.ZMQcontext.closed:
            scoop.SHUTDOWN_REQUESTED = True
            self.socket.send(SHUTDOWN)
            
            # pyzmq would issue an 'no module named zmqerror' on windows
            # without this
            try:
                self.direct_socket.__del__()
                self.socket.__del__()
                self.infoSocket.__del__()
            except AttributeError:
                # Older versions of pyzmq doesn't have the __del__ method
                pass

            self.ZMQcontext.destroy()
1200369
private void stopIn() throws IOException {
    if (inClosed) {
      return;
    }
    inClosed = true;

    LOG.log(Level.FINE, "Shutting down socket for input");

    // unblock all waiting readers
    setEof();

    // signal orchestrator thread it is ok to quit now as there will be no more input
    synchronized (orchestratorEvent) {
      shutdown = true;
      orchestratorEvent.notifyAll();
    }

    // close socket for input - that will cause readExecutor to throw EOFException
    // and exit orchestrator thread main loop; client can still write to the socket
    socket.shutdownInput();
  }
45293
public void stop() {
        try {
            safeClose(myServerSocket);
            closeAllConnections();
            myThread.join();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
369956
private void destroy()
  {
    if (log.isLoggable(Level.FINEST)) {
      log.finest(this + " destroying connection");
    }

    try {
      _socket.forceShutdown();
    } catch (Throwable e) {
    }

    try {
      closeConnection();
    } catch (Throwable e) {
      log.log(Level.FINER, e.toString(), e);
    }

    // XXX:
    _port.removeConnection(this);
  }
767161
def _handle_sighup(myrpcserver, signum, unused):
    """"""
    print("SIGHUP: stopping all clients",sys.stderr)
    if myrpcserver._closed:
        return
    for c in set(myrpcserver.clients):
        try:
            c.shutdown(socket.SHUT_RDWR)
        except Exception:
            pass
        c.close()
    myrpcserver.clients.clear()
1091492
def _on_connect_error(self, sock, err):  # pylint: disable=unused-argument
        """"""
        if isinstance(err, SystemExit):
            self.log.error(f"Shutting down websocket connection")
        else:
            self.log.error(f"Websocket error: {err}")