Send the content of the input buffer to all remote processes, this must
    be called in the main thread
183998
def process_input_buffer():
    """"""
    from polysh.control_commands_helpers import handle_control_command
    data = the_stdin_thread.input_buffer.get()
    remote_dispatcher.log(b'> ' + data)

    if data.startswith(b':'):
        try:
            handle_control_command(data[1:-1].decode())
        except UnicodeDecodeError as e:
            console_output(b'Could not decode command.')
        return

    if data.startswith(b'!'):
        try:
            retcode = subprocess.call(data[1:], shell=True)
        except OSError as e:
            if e.errno == errno.EINTR:
                console_output(b'Child was interrupted\n')
                retcode = 0
            else:
                raise
        if retcode > 128 and retcode <= 192:
            retcode = 128 - retcode
        if retcode > 0:
            console_output('Child returned {:d}\n'.format(retcode).encode())
        elif retcode < 0:
            console_output('Child was terminated by signal {:d}\n'.format(
                -retcode).encode())
        return

    for r in dispatchers.all_instances():
        try:
            r.dispatch_command(data)
        except asyncore.ExitNow as e:
            raise e
        except Exception as msg:
            raise msg
            console_output('{} for {}, disconnecting\n'.format(
                str(msg), r.display_name).encode())
            r.disconnect()
        else:
            if r.enabled and r.state is remote_dispatcher.STATE_IDLE:
                r.change_state(remote_dispatcher.STATE_RUNNING)
648989
def write_main_socket(c):
    """"""
    the_stdin_thread.socket_write.send(c)
    while True:
        try:
            the_stdin_thread.socket_write.recv(1)
        except socket.error as e:
            if e.errno != errno.EINTR:
                raise
        else:
            break
1216493
def Run(self):
        ""
        inputs = self.GetInput()
        return SendInput(
            len(inputs),
            ctypes.byref(inputs),
            ctypes.sizeof(INPUT))
109898
private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
        Http2FrameStream stream = data.stream();

        if (data.isEndStream()) {
            sendResponse(ctx, stream, data.content());
        } else {
            // We do not send back the response to the remote-peer, so we need to release it.
            data.release();
        }

        // Update the flowcontroller
        ctx.write(new DefaultHttp2WindowUpdateFrame(data.initialFlowControlledBytes()).stream(stream));
    }
506363
def send(self, s, end=os.linesep, signal=False):
        """"""

        if self.blocking:
            raise RuntimeError('send can only be used on non-blocking commands.')

        if not signal:
            if self._uses_subprocess:
                return self.subprocess.communicate(s + end)
            else:
                return self.subprocess.send(s + end)
        else:
            self.subprocess.send_signal(s)
592104
def _send_loop(self):
        
        while True:
            try:
                line = self.oqueue.get().splitlines()[0][:500]
                self._obuffer += line + '\r\n'
                while self._obuffer:
                    sent = self._socket.send(self._obuffer)
                    self._obuffer = self._obuffer[sent:]
            except Exception:
                break
53283
def __send_buffer(self):
        
        bytes_written = self.serial.write(self.__out_buffer.raw)
        if self.DEBUG_MODE:
            print("Wrote: '{}'".format(binascii.hexlify(self.__out_buffer.raw)))
        if bytes_written != len(self.__out_buffer):
            raise IOError("{} bytes written for output buffer of size {}".format(bytes_written,
                                                                                 len(self.__out_buffer)))
        return bytes_written
182945
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties)
        throws RemoteException
    {
        String strCommand = this.getProperty(REMOTE_COMMAND, properties);
        if (SEND_MESSAGE.equals(strCommand))
        {
            BaseMessage message = (BaseMessage)this.getNextObjectParam(in, MESSAGE, properties);
            ((RemoteSendQueue)m_remoteObject).sendMessage(message);
        }
        else
            super.doProcess(in, out, properties);
    }
1285081
def send(self, targetPath, parent, diff, showProgress=True, allowDryRun=True):
        
        if parent is not None:
            cmd = ["btrfs", "send", "-p", parent, targetPath]
        else:
            cmd = ["btrfs", "send", targetPath]

        if Store.skipDryRun(logger, self.dryrun and allowDryRun)("Command: %s", cmd):
            return None

        process = subprocess.Popen(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=DEVNULL)
        _makeNice(process)

        return _Reader(process, process.stdout, targetPath, diff, showProgress)
75283
def run(stream=sys.stdin.buffer):
    
    payload = decode.decode(stream)
    sys.stdout.write(payload.decode('utf8'))
988661
public void sendBuffer(Buffer buffer) throws IOException, InterruptedException {
		checkStatus();

		// discard empty buffers
		if (buffer.size() == 0) {
			return;
		}

		Envelope envelope = createNextEnvelope();
		envelope.setBuffer(buffer);
		this.envelopeDispatcher.dispatchFromOutputChannel(envelope);
	}
679736
def _sender_main(self):
        
        if not self._http_host:
            self._choose_host()
        last_batch_time = datetime.datetime.utcnow()

        while not (self._is_terminated.is_set() and self._event_queue.empty()):
            batch = None
            try:
                if not self._is_connected.is_set():
                    self._verify_connection()

                batch = self._get_batch(last_batch_time)
                self._send_batch(batch)

            except exceptions.ConnectionFailed:  # Failed to connect to server
                time.sleep(consts.NO_CONNECTION_SLEEP_TIME)
                self._is_connected.clear()

            except exceptions.EmptyBatch:  # No events in queue, go to sleep
                time.sleep(consts.EMPTY_BATCH_SLEEP_TIME)

            except exceptions.SendFailed as ex:  # Failed to send an event batch
                self._notify(ex.severity, str(ex))
                self._is_connected.clear()

                if batch:  # Failed after pulling a batch from the queue
                    self._enqueue_batch(batch)
                    logger.debug(consts.LOG_MSG_ENQUEUED_FAILED_BATCH,
                                 len(batch))

            else:  # We sent a batch successfully, server is reachable
                self._is_connected.set()

            finally:  # Advance last batch time
                last_batch_time = datetime.datetime.utcnow()
568859
def flush(self):
        
        local_sender = self.sender
        if not local_sender:
            return
        while True:
            # get at most send_buffer_size items and send them
            data = []
            while len(data) < local_sender.send_buffer_size:
                item = self.get()
                if not item:
                    break
                data.append(item)
            if len(data) == 0:
                break
            local_sender.send(data)
138112
def send(frame)
      if Frame::Data === frame
        @send_buffer << frame
        if @send_remaining_window < frame.length
          if Stream === self
            connection.callback(:send_deferred, self, frame)
          else
            callback(:send_deferred, self, frame)
          end
        else
          consume_send_buffer
        end
      else
        send_immediately frame
      end
    end
1297860
async def send(self, data):
        
        self.writer.write(data)
        await self.writer.drain()
914975
private void flushBuffer() throws IOException
    {
        while (_flush.hasRemaining())
        {
            int len=_channel.write(_flush);
            if (len<0)
                throw new IOException("EOF");
            if (len==0)
            {
                // write channel full.  Try letting other threads have a go.
                Thread.yield();
                len=_channel.write(_flush);
                if (len<0)
                    throw new IOException("EOF");
                if (len==0)
                {
                    // still full.  need to  block until it is writable.
                    if (_selector==null)
                     {
                            _selector=Selector.open();
                            _channel.register(_selector,SelectionKey.OP_WRITE);
                     }

                     _selector.select();
                }
            }
        }
    }
668737
def write(self, buffer):
        
        if type(buffer) == type(0):
            buffer = chr(buffer)
        elif not isinstance(buffer, bytes):
            buffer = buffer.encode(self.encoding)
        if IAC in buffer:
            buffer = buffer.replace(IAC, IAC+IAC)
        self.msg("send %s", repr(buffer))
        self.sock.send(buffer)