*
Add an ip for Sender object
10299
public function getIP()
    {
        if (function_exists('apache_request_headers')) {
            $headers = apache_request_headers();
        } else {
            $headers = $_SERVER;
        }
 
        if (array_key_exists('X-Forwarded-For', $headers)
            && filter_var($headers['X-Forwarded-For'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ) {
            $ip = $headers['X-Forwarded-For'];
 
        } elseif (array_key_exists('HTTP_X_FORWARDED_FOR', $headers)
            && filter_var($headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            $ip = $headers['HTTP_X_FORWARDED_FOR'];
 
        } else {
            $ip = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);
        }

        $this->ip = $ip;
    }
825013
def modify_ip(self, ip_addr, ptr_record):
        
        body = {
            'ip_address': {
                'ptr_record': ptr_record
            }
        }

        res = self.request('PUT', '/ip_address/' + str(ip_addr), body)
        return IPAddress(cloud_manager=self, **res['ip_address'])
260998
public int sendUDP (Object object) {
		if (object == null) throw new IllegalArgumentException("object cannot be null.");
		SocketAddress address = udpRemoteAddress;
		if (address == null && udp != null) address = udp.connectedAddress;
		if (address == null && isConnected) throw new IllegalStateException("Connection is not connected via UDP.");

		try {
			if (address == null) throw new SocketException("Connection is closed.");

			int length = udp.send(this, object, address);
			if (length == 0) {
				if (TRACE) trace("kryonet", this + " UDP had nothing to send.");
			} else if (DEBUG) {
				if (length != -1) {
					String objectString = object == null ? "null" : object.getClass().getSimpleName();
					if (!(object instanceof FrameworkMessage)) {
						debug("kryonet", this + " sent UDP: " + objectString + " (" + length + ")");
					} else if (TRACE) {
						trace("kryonet", this + " sent UDP: " + objectString + " (" + length + ")");
					}
				} else
					debug("kryonet", this + " was unable to send, UDP socket buffer full.");
			}
			return length;
		} catch (IOException ex) {
			if (DEBUG) debug("kryonet", "Unable to send UDP with connection: " + this, ex);
			close();
			return 0;
		} catch (KryoNetException ex) {
			if (ERROR) error("kryonet", "Unable to send UDP with connection: " + this, ex);
			close();
			return 0;
		}
	}
32885
def send_udp_connection(ip, port, mode)
      @client.send({
        op: 1,
        d: {
          protocol: 'udp',
          data: {
            address: ip,
            port: port,
            mode: mode
          }
        }
      }.to_json)
    end
1195019
def add_ip_to_net(networks, host):
    
    for network in networks:
        if host['ipaddr'] in network['network']:
            network['hosts'].append(host)
            return
307780
def send_message(host, data, timeout=None, properties=None):
    
    channel = _get_channel(host, timeout)

    if not properties:
        properties = pika.BasicProperties(
            content_type="application/json",
            delivery_mode=2,
            headers={"UUID": str(uuid.uuid4())}
        )

    parameters = settings.get_amqp_settings()[host]

    channel.basic_publish(
        exchange=parameters["exchange"],
        routing_key=parameters["in_key"],
        properties=properties,
        body=data
    )
788984
def to(self, linode):
        
        from .linode import Instance
        if not isinstance(linode, Instance):
            raise ValueError("IP Address can only be assigned to a Linode!")
        return { "address": self.address, "linode_id": linode.id }
26844
function Importer(ip, username, password) {
    events.EventEmitter.call(this);

    /**
     * @property ip
     * @private
     * @type {String}
     */
    this.ip = ip;
    /**
     * @property username
     * @private
     * @type {String}
     */
    this.username = username;
    /**
     * @property password
     * @private
     * @type {String}
     */
    this.password = password;
}
253392
def _set_ip(self):
        """"""
        self._ip = socket.gethostbyname(self._fqdn)
        log.debug('IP: %s' % self._ip)
1313454
def add_nic(self, instance_id, net_id):
        """"""
        #TODO: upgrade with port_id and fixed_ip in future
        self.client.servers.interface_attach(
            instance_id, None, net_id, None)
        return True
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();
            });
        });

    }
1111876
def _make_socket(cls, ip, port):
    
    bound_socket = bind_sockets(port, address=ip)[0]
    ip, port = bound_socket.getsockname()

    if not ip or ip == '0.0.0.0':
      ip = socket.gethostbyname(socket.gethostname())

    return bound_socket, ip, port
143713
def allow(self, ip):
        
        self.whitelist.append(ip)
        self.blacklist.clear()
633615
def associate_public_ip(self, instance_id, public_ip_id, private_ip=None):
        """"""
        floating_ip = self.client.floating_ips.get(public_ip_id)
        floating_ip = floating_ip.to_dict()
        address = floating_ip.get('ip')

        self.client.servers.add_floating_ip(instance_id, address, private_ip)

        return True
874283
def add_host_supersede_name(self, ip, mac, name):  # pylint:disable=E0213
		
		msg = OmapiMessage.open(b"host")
		msg.message.append((b"create", struct.pack("!I", 1)))
		msg.message.append((b"exclusive", struct.pack("!I", 1)))
		msg.obj.append((b"hardware-address", pack_mac(mac)))
		msg.obj.append((b"hardware-type", struct.pack("!I", 1)))
		msg.obj.append((b"ip-address", pack_ip(ip)))
		msg.obj.append((b"name", name.encode('utf-8')))
		msg.obj.append((b"statements", 'supersede host-name "{0}";'.format(name).encode('utf-8')))
		response = self.query_server(msg)
		if response.opcode != OMAPI_OP_UPDATE:
			raise OmapiError("add failed")
1270313
def add_host(zone, name, ttl, ip, nameserver='127.0.0.1', replace=True,
             timeout=5, port=53, **kwargs):
    '''
    
    '''
    res = update(zone, name, ttl, 'A', ip, nameserver, timeout, replace, port,
                 **kwargs)
    if res is False:
        return False

    fqdn = '{0}.{1}.'.format(name, zone)
    parts = ip.split('.')[::-1]
    popped = []

    # Iterate over possible reverse zones
    while len(parts) > 1:
        p = parts.pop(0)
        popped.append(p)
        zone = '{0}.{1}'.format('.'.join(parts), 'in-addr.arpa.')
        name = '.'.join(popped)
        ptr = update(zone, name, ttl, 'PTR', fqdn, nameserver, timeout,
                     replace, port, **kwargs)
        if ptr:
            return True
    return res
868545
def address(self, ip, owner=None, **kwargs):
        
        return Address(self.tcex, ip, owner=owner, **kwargs)