Send data to connected gateway
975123
def send_data(self, data, delay=COMMAND_DELAY):
        

        time_since_last_send = time.time() - self._last_send
        delay = max(0, delay - time_since_last_send)
        time.sleep(delay)  # Ensure minim recommended delay since last send

        for item in data:
            data = bytes.fromhex(str(item.zfill(2)))
            try:
                self.sock.send(data)
            except ConnectionResetError as msg:
                _LOGGER.error("Error trying to connect to Russound controller. "
                              "Check that no other device or system is using the port that "
                              "you are trying to connect to. Try resetting the bridge you are using to connect.")
                _LOGGER.error(msg)
        self._last_send = time.time()
602079
public String sendMessage(String gatewayId, Struct data) throws PageException, IOException {
	Gateway g = getGateway(gatewayId);
	if (g.getState() != Gateway.RUNNING) throw new GatewayException("Gateway [" + gatewayId + "] is not running");
	return g.sendMessage(data);
    }
1078005
protected static function sendToAllGateway($gateway_data)
    {
        $buffer = GatewayProtocol::encode($gateway_data);
        // 如果有businessWorker实例，说明运行在workerman环境中，通过businessWorker中的长连接发送数据
        if (static::$businessWorker) {
            foreach (static::$businessWorker->gatewayConnections as $gateway_connection) {
                /** @var TcpConnection $gateway_connection */
                $gateway_connection->send($buffer, true);
            }
        } // 运行在其它环境中，通过注册中心得到gateway地址
        else {
            $all_addresses = static::getAllGatewayAddressesFromRegister();
            foreach ($all_addresses as $address) {
                static::sendBufferToGateway($address, $buffer);
            }
        }
    }
1120484
def send(self, data):
        
        if self.readyState != 'open':
            raise InvalidStateError

        if not isinstance(data, (str, bytes)):
            raise ValueError('Cannot send unsupported data type: %s' % type(data))

        self.transport._data_channel_send(self, data)
1092818
def send(self, notification):
        """"""
        logger.debug('Gateway send notification')

        if self.client is None:
            raise GatewayClientNotSetError()

        yield self.client.send(notification)
285232
def _send(self, messagetype, packet):
		""""""

		packet.validate()
		data = packet.encode()

		logger.debug('To : %s:%s <%s>\n%s', self.hostname, self.port, packet.__class__, data)

		s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		s.settimeout(self.socketTimeout)
		try:
			s.connect((self.hostname, self.port))
			s.send(data)
			recv_data = s.recv(1024)
			while not recv_data.endswith(gntp.shim.b("\r\n\r\n")):
				recv_data += s.recv(1024)
		except socket.error:
			# Python2.5 and Python3 compatibile exception
			exc = sys.exc_info()[1]
			raise errors.NetworkError(exc)

		response = gntp.core.parse_gntp(recv_data)
		s.close()

		logger.debug('From : %s:%s <%s>\n%s', self.hostname, self.port, response.__class__, response)

		if type(response) == gntp.core.GNTPOK:
			return True
		logger.error('Invalid response: %s', response.error())
		return response.error()
955697
def _send(self, ip, port, data):
        
        return self._listen_socket.sendto(data, (ip, port))
935167
def send(self, data):
        """"""
        # send message
        _LOGGER.debug("send: " + data)
        self.socket.send(data.encode('ascii'))
        # sleep needed to prevent flooding the GC100 with sends
        sleep(.01)
1308206
def send_data(self):
        """"""
        if not self.connection._sock:
            raise err.InterfaceError("(0, '')")
        conn = self.connection

        try:
            with open(self.filename, 'rb') as open_file:
                packet_size = min(conn.max_allowed_packet, 16*1024)  # 16KB is efficient enough
                while True:
                    chunk = open_file.read(packet_size)
                    if not chunk:
                        break
                    conn.write_packet(chunk)
        except IOError:
            raise err.OperationalError(1017, "Can't find file '{0}'".format(self.filename))
        finally:
            # send the empty packet to signify we are done sending data
            conn.write_packet(b'')
753700
function TcpClientEnd () {
    var svcopts   = this.svcopts;  // make objec info visible inside timer handler
    var controller= this.controller;
    var gateway   = this.controller.gateway;
    var svc       = this.controller.svc;
        
    controller.Debug (4,"[%s] connection ended", this.uid);
    this.adapter.ClientQuit(this);
    setTimeout (function(){ // wait for timeout and recreate a new Object from scratch
        gateway.controllers [svc] = new Controller (gateway, svcopts, svc);
    }, this.svcopts.timeout*1000);
}
1314976
def set_gateway(self, gateway):
        '''
        
        '''
        self.gateway = gateway
        if (self._gemeente is not None):
            self._gemeente.set_gateway(gateway)
1300789
def send(self, data):
        """"""
        log.debug('Sending %s' % data)
        if not self._socket:
            log.warn('No connection')
            return
        self._socket.send_bytes(data.encode('utf-8'))
1347730
def _send_user_message(self, data):
        
        start = time.time()
        while True:
            self.clear_to_send.wait(0.1)
            if not self.active:
                self._log(DEBUG, 'Dropping user packet because connection is dead.')
                return
            self.clear_to_send_lock.acquire()
            if self.clear_to_send.isSet():
                break
            self.clear_to_send_lock.release()
            if time.time() > start + self.clear_to_send_timeout:
              raise SSHException('Key-exchange timed out waiting for key negotiation')
        try:
            self._send_message(data)
        finally:
            self.clear_to_send_lock.release()
1001950
async def send_script(self, conn_id, data):
        

        self._ensure_connection(conn_id, True)
        dev = self._get_property(conn_id, 'device')
        conn_string = self._get_property(conn_id, 'connection_string')

        # Simulate some progress callbacks (0, 50%, 100%)
        await self.notify_progress(conn_string, 'script', 0, len(data))
        await self.notify_progress(conn_string, 'script', len(data) // 2, len(data))
        await self.notify_progress(conn_string, 'script', len(data), len(data))

        dev.script = data
402127
def _send_packet(self, packet):
        """"""
        encoded = json.dumps(packet)
        self.ws.send(encoded)
1165116
def connect_network_gateway(self, gateway_id, body=None):
        """"""
        base_uri = self.network_gateway_path % gateway_id
        return self.put("%s/connect_network" % base_uri, body=body)
34144
def sendConnect(self, data):
        """"""
        # Imported dynamically - Not used if only one broker
        if self.backend == 'ZMQ':
            import zmq
            self.context = zmq.Context()
            self.socket = self.context.socket(zmq.DEALER)
            if sys.version_info < (3,):
                self.socket.setsockopt_string(zmq.IDENTITY, unicode('launcher'))
            else:
                self.socket.setsockopt_string(zmq.IDENTITY, 'launcher')
            self.socket.connect(
                "tcp://{hostname}:{port}".format(
                    port=self.brokerPort,
                    hostname = self.hostname
                )
            )
            self.socket.send_multipart([b"CONNECT",
                                        pickle.dumps(data,
                                                     pickle.HIGHEST_PROTOCOL)])
        else:
            # TODO
            pass