send a message over the wire; callback=None indicates a safe=False call where we write and forget about it
171140
def send_message(self, message, callback):
        
        
        if self.__callback is not None:
            raise ProgrammingError('connection already in use')

        if callback:
            err_callback = functools.partial(callback, None)
        else:
            err_callback = None

        # Go and update err_callback for async jobs in queue if any
        for job in self.__job_queue:
            # this is a dirty hack and I hate it, but there is no way of setting the correct
            # err_callback during the connection time
            if isinstance(job, asyncjobs.AsyncJob):
                job.update_err_callback(err_callback)

        if not self.__alive:
            if self.__autoreconnect:
                self.__connect(err_callback)
            else:
                raise InterfaceError('connection invalid. autoreconnect=False')
        
        # Put the current message on the bottom of the queue
        self._put_job(asyncjobs.AsyncMessage(self, message, callback), 0)
        self._next_job()
371257
function send() {
  var message = arguments.length <= 0 || arguments[0] === undefined ? 'hello mqtt-controls' : arguments[0];
  var topic = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];

  var t = undefined;
  if (topic === null) {
    t = topics.publish;
  } else {
    t = topic;
  }
  client.publish(t, message);
}
897829
function sendMyInfo(senderMessage, senderInfo) {

        if (mode == "listen") {
            return;
        }

        var message = createMessage("ONE");
        var socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });

        socket.bind(function() {
            socket.send(message, 0, message.length, senderMessage.port, senderInfo.address, function(err, bytes) {
                socket.close();
            });
        });

    }
910553
function sendMessage (client, data, batchCallback) {
  var msg = data.msg;
  var offset = data.offset;
  var length = data.length;
  var port = data.port;
  var address = data.address;
  var callback = data.callback;

  client.send(msg, offset, length, port, address, function(err) {
    try {
      callback(err);
    } finally {
      batchCallback();
    }
  });
}
168679
def on_send(self, frame):
        
        print('on_send %s %s %s' % (frame.cmd, frame.headers, frame.body))
12653
def send(self, msg, timeout=None, callback=None, raw=False):
        '''
        
        '''
        message_id = self._message_id()
        header = {'mid': message_id}

        future = tornado.concurrent.Future()
        if callback is not None:
            def handle_future(future):
                response = future.result()
                self.io_loop.add_callback(callback, response)
            future.add_done_callback(handle_future)
        # Add this future to the mapping
        self.send_future_map[message_id] = future

        if self.opts.get('detect_mode') is True:
            timeout = 1

        if timeout is not None:
            send_timeout = self.io_loop.call_later(timeout, self.timeout_message, message_id)
            self.send_timeout_map[message_id] = send_timeout

        # if we don't have a send queue, we need to spawn the callback to do the sending
        if not self.send_queue:
            self.io_loop.spawn_callback(self._stream_send)
        self.send_queue.append((message_id, salt.transport.frame.frame_msg(msg, header=header)))
        return future
904699
void send(AbstractMessage aMessage, int priority)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "send", new Object[] {this,
                                            aMessage,
                                            new Integer(priority),
                                            "verboseMsg OUT : " + aMessage.toVerboseString()});
    if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      MPIOMsgDebug.debug(tc, aMessage, priority);
    
    // comms accepting messages, write the message
    // immediately.
    try
    {
      //send the encoded message
      connection.send(aMessage, priority);          

      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message accepted by Comms");
    } 
    catch (SIConnectionDroppedException e)
    {
      // No FFDC code needed
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Connection Dropped");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }       
    catch (SIConnectionUnavailableException e)
    {
      // No FFDC code needed
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Connection Unavailable");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    } 
    catch (SIConnectionLostException e)
    {
      // No FFDC code needed
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Connection Lost");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(MessageEncodeFailedException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Msg Encode Failed");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(MessageCopyFailedException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Msg Copy Failed");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(UnsupportedEncodingException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Msg Encoding Failed");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(IncorrectMessageTypeException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Incorrect Message Type");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
      
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "send");
  }
595348
def communicate(*messages, &callback)
      @available = false
      @data = ''
      @callback = callback
      messages = messages.first if messages.size == 1 and messages.first.is_a?(Array)
      messages = messages.join(' ') << "\n"
      send_data(messages)
    end
231170
def _write_callback(connection_id, data_buffer, data_length_pointer):
    
    wrapped_socket = None
    try:
        wrapped_socket = _connection_refs.get(connection_id)
        if wrapped_socket is None:
            return SecurityConst.errSSLInternal
        base_socket = wrapped_socket.socket

        bytes_to_write = data_length_pointer[0]
        data = ctypes.string_at(data_buffer, bytes_to_write)

        timeout = wrapped_socket.gettimeout()
        error = None
        sent = 0

        try:
            while sent < bytes_to_write:
                if timeout is None or timeout >= 0:
                    if not util.wait_for_write(base_socket, timeout):
                        raise socket.error(errno.EAGAIN, 'timed out')
                chunk_sent = base_socket.send(data)
                sent += chunk_sent

                # This has some needless copying here, but I'm not sure there's
                # much value in optimising this data path.
                data = data[chunk_sent:]
        except (socket.error) as e:
            error = e.errno

            if error is not None and error != errno.EAGAIN:
                data_length_pointer[0] = sent
                if error == errno.ECONNRESET or error == errno.EPIPE:
                    return SecurityConst.errSSLClosedAbort
                raise

        data_length_pointer[0] = sent

        if sent != bytes_to_write:
            return SecurityConst.errSSLWouldBlock

        return 0
    except Exception as e:
        if wrapped_socket is not None:
            wrapped_socket._exception = e
        return SecurityConst.errSSLInternal
402762
function sendMessage(command, opt_value, opt_transfer) {
    // TODO(benvanik): attempt to use webkitPostMessage
    originalPostMessage.call(goog.global, {
      '__wtf_worker_msg__': true,
      'command': command,
      'value': opt_value || null
    }, []);
  }
678679
def send(self, message, _sender=None):
        """"""
        if not _sender:
            context = get_context()
            if context:
                _sender = context.ref
        if self._cell:
            if not self._cell.stopped:
                self._cell.receive(message, _sender)
                return
            else:
                self._cell = None
        if not self.is_local:
            if self.uri.node != self.node.nid:
                self.node.send_message(message, remote_ref=self, sender=_sender)
            else:
                self._cell = self.node.guardian.lookup_cell(self.uri)
                self.is_local = True
                self._cell.receive(message, _sender)
        else:
            if self.node and self.node.guardian:
                cell = self.node.guardian.lookup_cell(self.uri)
                if cell:
                    cell.receive(message, _sender)  # do NOT set self._cell--it will never be unset and will cause a memleak
                    return
            if ('_watched', ANY) == message:
                message[1].send(('terminated', self), _sender=self)
            elif (message == ('terminated', ANY) or message == ('_unwatched', ANY) or message == ('_node_down', ANY) or
                  message == '_stop' or message == '_kill' or message == '__done'):
                pass
            else:
                Events.log(DeadLetter(self, message, _sender))
179579
def _send_msg(self, header, payload):
        """"""

        if self.verbose:
            print('->', repr(header))
            print('..', repr(payload))
        assert header.payload == len(payload)
        try:
            sent = self.socket.send(header + payload)
        except IOError as err:
            raise ConnError(*err.args)

        # FIXME FIXME FIXME:
        # investigate under which situations socket.send should be retried
        # instead of aborted.
        # FIXME FIXME FIXME
        if sent < len(header + payload):
            raise ShortWrite(sent, len(header + payload))
        assert sent == len(header + payload), sent
1315610
def send(self, msg):
        """"""
        if self._conn:
            self._conn.write_data(msg.message, msg.response_command)
838613
function sendNameAlreadyTaken(senderMessage, senderInfo) {

        if (mode == "listen") {
            return;
        }

        var message = createMessage("NAMETAKEN");
        var socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });

        socket.bind(function() {
            log("%s [%s] sent '%s' to %s:%s", name, id, message, senderInfo.address, senderInfo.port);
            socket.send(message, 0, message.length, senderMessage.port, senderInfo.address, function(err, bytes) {
                socket.close();
            });
        });

    }
1277865
function _send(cmd, callback) {
      cmd_callback = callback;
      if(connected) {
        client.write(cmd + '\n');
      } else {
        connect();
      }
    }
434828
def send(self, *args):
        
        for frame in args:
            self.sock.sendall(self.apply_send_hooks(frame, False).pack())
1219024
function (data, callback) {
    this.debug("Sending: %s", JSON.stringify(data));
    var message = dazeusify.call(this, data);
    this.client.write(message, callback);
}