Sends a packet to an already known user or one of his clients by
        UUID
162392
def send(self, event):
        """"""

        try:
            jsonpacket = json.dumps(event.packet, cls=ComplexEncoder)
            if event.sendtype == "user":
                # TODO: I think, caching a user name <-> uuid table would
                # make sense instead of looking this up all the time.

                if event.uuid is None:
                    userobject = objectmodels['user'].find_one({
                        'name': event.username
                    })
                else:
                    userobject = objectmodels['user'].find_one({
                        'uuid': event.uuid
                    })

                if userobject is None:
                    self.log("No user by that name known.", lvl=warn)
                    return
                else:
                    uuid = userobject.uuid

                self.log("Broadcasting to all of users clients: '%s': '%s" % (
                    uuid, str(event.packet)[:20]), lvl=network)
                if uuid not in self._users:
                    self.log("User not connected!", event, lvl=critical)
                    return
                clients = self._users[uuid].clients

                for clientuuid in clients:
                    sock = self._clients[clientuuid].sock

                    if not event.raw:
                        self.log("Sending json to client", jsonpacket[:50],
                                 lvl=network)

                        self.fireEvent(write(sock, jsonpacket), "wsserver")
                    else:
                        self.log("Sending raw data to client")
                        self.fireEvent(write(sock, event.packet), "wsserver")
            else:  # only to client
                self.log("Sending to user's client: '%s': '%s'" % (
                    event.uuid, jsonpacket[:20]), lvl=network)
                if event.uuid not in self._clients:
                    if not event.fail_quiet:
                        self.log("Unknown client!", event.uuid, lvl=critical)
                        self.log("Clients:", self._clients, lvl=debug)
                    return

                sock = self._clients[event.uuid].sock
                if not event.raw:
                    self.fireEvent(write(sock, jsonpacket), "wsserver")
                else:
                    self.log("Sending raw data to client", lvl=network)
                    self.fireEvent(write(sock, event.packet[:20]), "wsserver")

        except Exception as e:
            self.log("Exception during sending: %s (%s)" % (e, type(e)),
                     lvl=critical, exc=True)
865301
def send(x, inter=0, loop=0, count=None, verbose=None, realtime=None, *args, **kargs):
    """"""
    __gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
1253160
def authentication(self, event):
        """"""

        try:
            self.log("Authorization has been granted by DB check:",
                     event.username, lvl=debug)

            account, profile, clientconfig = event.userdata

            useruuid = event.useruuid
            originatingclientuuid = event.clientuuid
            clientuuid = clientconfig.uuid

            if clientuuid != originatingclientuuid:
                self.log("Mutating client uuid to request id:",
                         clientuuid, lvl=network)
            # Assign client to user
            if useruuid in self._users:
                signedinuser = self._users[useruuid]
            else:
                signedinuser = User(account, profile, useruuid)
                self._users[account.uuid] = signedinuser

            if clientuuid in signedinuser.clients:
                self.log("Client configuration already logged in.",
                         lvl=critical)
                # TODO: What now??
                # Probably senseful would be to add the socket to the
                # client's other socket
                # The clients would be identical then - that could cause
                # problems
                # which could be remedied by duplicating the configuration
            else:
                signedinuser.clients.append(clientuuid)
                self.log("Active client (", clientuuid, ") registered to "
                                                        "user", useruuid,
                         lvl=debug)

            # Update socket..
            socket = self._sockets[event.sock]
            socket.clientuuid = clientuuid
            self._sockets[event.sock] = socket

            # ..and client lists

            try:
                language = clientconfig.language
            except AttributeError:
                language = "en"

            # TODO: Rewrite and simplify this:
            newclient = Client(
                sock=event.sock,
                ip=socket.ip,
                clientuuid=clientuuid,
                useruuid=useruuid,
                name=clientconfig.name,
                config=clientconfig,
                language=language
            )

            del (self._clients[originatingclientuuid])
            self._clients[clientuuid] = newclient

            authpacket = {"component": "auth", "action": "login",
                          "data": account.serializablefields()}
            self.log("Transmitting Authorization to client", authpacket,
                     lvl=network)
            self.fireEvent(
                write(event.sock, json.dumps(authpacket)),
                "wsserver"
            )

            profilepacket = {"component": "profile", "action": "get",
                             "data": profile.serializablefields()}
            self.log("Transmitting Profile to client", profilepacket,
                     lvl=network)
            self.fireEvent(write(event.sock, json.dumps(profilepacket)),
                           "wsserver")

            clientconfigpacket = {"component": "clientconfig", "action": "get",
                                  "data": clientconfig.serializablefields()}
            self.log("Transmitting client configuration to client",
                     clientconfigpacket, lvl=network)
            self.fireEvent(write(event.sock, json.dumps(clientconfigpacket)),
                           "wsserver")

            self.fireEvent(userlogin(clientuuid, useruuid, clientconfig, signedinuser))

            self.log("User configured: Name",
                     signedinuser.account.name, "Profile",
                     signedinuser.profile.uuid, "Clients",
                     signedinuser.clients,
                     lvl=debug)

        except Exception as e:
            self.log("Error (%s, %s) during auth grant: %s" % (
                type(e), e, event), lvl=error)
1153555
def ping(payload, &blk)
      send(type: :ping, stream: 0, payload: payload)
      once(:ack, &blk) if blk
    end
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()
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'')
387048
def write_packets(self):
        """"""
        while self.running:
            if len(self.write_queue) > 0:
                self.write_queue[0].send(self.client)
                self.write_queue.pop(0)
700025
def send(self, payload):
        
        payload = self.encode(payload)
        payload = self.sign(payload)
        self.socket.send(payload)
1016962
def send_encoded(self, message, auth_header=None, **kwargs):
        
        client_string = 'raven-python/%s' % (raven.VERSION,)

        if not auth_header:
            timestamp = time.time()
            auth_header = get_auth_header(
                protocol=self.protocol_version,
                timestamp=timestamp,
                client=client_string,
                api_key=self.remote.public_key,
                api_secret=self.remote.secret_key,
            )

        headers = {
            'User-Agent': client_string,
            'X-Sentry-Auth': auth_header,
            'Content-Encoding': self.get_content_encoding(),
            'Content-Type': 'application/octet-stream',
        }

        return self.send_remote(
            url=self.remote.store_endpoint,
            data=message,
            headers=headers,
            **kwargs
        )
221074
public void send(Packet packet) {
        if (log.isTraceEnabled()) {
            log.trace("send packet: {}", packet);
        }
        // no handshake flag, queue the packet
        if (session.containsAttribute(Constants.HANDSHAKE_COMPLETE)) {
            try {
                // clear any queued items first
                queue.forEach(entry -> {
                    session.write(entry);
                    queue.remove(entry);
                });
            } catch (Exception e) {
                log.warn("Exception draining queued packets on session: {}", session.getId(), e);
            }
            // process the incoming packet
            session.write(packet);
        } else {
            if (handshakeWriteFuture != null) {
                log.warn("Handshake is not complete yet on session: {} written? {}", session.getId(), handshakeWriteFuture.isWritten(), handshakeWriteFuture.getException());
            } else {
                log.warn("Handshake is not complete yet on session: {}", session.getId());
            }
            // not queuing pings
            MessageType type = packet.getType();
            if (type != MessageType.PING && type != MessageType.PONG) {
                log.info("Placing {} message in session: {} queue", type, session.getId());
                queue.offer(packet);
            }
        }
    }
485341
def _send_packet(self, data):
        
        if self._closed:
            return

        data = json.dumps(data)

        def send():
            try:
                yield From(self.pipe_connection.write(data))
            except BrokenPipeError:
                self.detach_and_close()
        ensure_future(send())
489370
protected void send() {

		// Check number of packets
		int udpMaxDiscovery = transporter.getUdpMaxDiscovery();
		if (udpMaxDiscovery > 0) {
			if (numberOfSubmittedPackets >= udpMaxDiscovery) {

				// Has no timer
				if (timer != null) {
					logger.info("Discovery service stopped successfully, " + udpMaxDiscovery + " packets sent.");
					timer.cancel(false);
					timer = null;
				}

				// Has timer
				return;
			}
		}
		numberOfSubmittedPackets++;
		synchronized (receivers) {

			// First time use the all address to notify other nodes
			if (numberOfSubmittedPackets == 1) {
				for (UDPReceiver receiver : receivers) {
					receiver.send();
					try {
						Thread.sleep(200);
					} catch (InterruptedException interrupt) {
						return;
					}
				}
				return;
			}

			// Use the next network address
			nextIndex++;
			if (nextIndex >= receivers.size()) {
				nextIndex = 0;
			}
			receivers.get(nextIndex).send();
		}
	}
55184
def retransmit(self, data):
        

        # If that shit is still in self.event_uuids, then that means we STILL
        # haven't gotten a response from the client. Then we resend that shit
        # and WAIT
        if data["euuid"] in self.event_uuids:
            # Increment the current retry count of the euuid
            self.event_uuids[data["euuid"]] += 1

            # If we've tried more than the maximum, just log an error
            # and stahap.
            if (self.event_uuids[data["euuid"]] > self.max_retries or
                    data["cuuid"] not in self.registry):
                logger.warning("<%s> Retry limit exceeded. "
                               "Timed out waiting for client for "
                               "event: %s" % (data["cuuid"], data["euuid"]))
                logger.warning("<%s> Deleting event from currently processing "
                               "event uuids" % data["cuuid"])
                del self.event_uuids[data["euuid"]]
            else:
                # Retransmit that shit
                logger.debug("<%s> Timed out waiting for response. Retry %s. "
                             "Retransmitting message: "
                             "%s" % (data["cuuid"],
                                     pformat(self.event_uuids[data["euuid"]]),
                                     data["response"]))

                # Look up the host and port based on cuuid
                host = self.registry[data["cuuid"]]["host"]
                port = self.registry[data["cuuid"]]["port"]

                # Send the packet to the client
                self.listener.send_datagram(data["response"], (host, port))

                # Then we set another schedule to check again
                logger.debug("<%s> Scheduling to retry in %s "
                             "seconds" % (data["cuuid"], str(self.timeout)))
                self.listener.call_later(self.timeout, self.retransmit, data)
908868
def send_subscribe(self, dup, topics):
        """"""
        pkt = MqttPkt()
        
        pktlen = 2 + sum([2+len(topic)+1 for (topic, qos) in topics])
        pkt.command = NC.CMD_SUBSCRIBE | (dup << 3) | (1 << 1)
        pkt.remaining_length = pktlen
        
        ret = pkt.alloc()
        if ret != NC.ERR_SUCCESS:
            return ret
        
        #variable header
        mid = self.mid_generate()
        pkt.write_uint16(mid)
        
        #payload
        for (topic, qos) in topics:
            pkt.write_string(topic)
            pkt.write_byte(qos)
        
        return self.packet_queue(pkt)
211827
def _inbound(self, From, to, protocol, udp_source=None):
        
        # Verify stuff!

        self.verifyCertificateAllowed(to, From)
        return self.service.verifyHook(From, to, protocol
                                       ).addCallback(self._inboundimpl,
                                                     From,
                                                     to,
                                                     protocol,
                                                     udp_source).addErrback(
            lambda f: f.trap(KeyError) and dict(listeners=[]))
1224322
def send(self, sender, **kwargs):
        """"""
        if id(self) not in _alleged_receivers:
            return
        for func in _alleged_receivers[id(self)]:
            func(sender, **kwargs)
806071
function(userObj, setname, hashPrefix, cb){

      // client.srem('users',userObj.uuid, redis.print)

      var _uuid = sha1('photopipe', userObj.email_address)
      
      client.srem(setname, _uuid, function(e,d){
        
        if(cb){
          return cb(e,d)
        } 
        
        userSetRemoveHandler(e,d)

        client.hdel(hashPrefix+':'+_uuid, userObj, userDeleteHashHandler)
        
      })
      

    }