• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(1624)  |  Call(1555)  |  Derive(0)  |  Import(69)
gethostbyname(host) -> address

Return the IP address (a string of the form '255.255.255.255') for a host.

src/p/s/psp_samples-HEAD/psplibs-pygame_mockup/pspnet.py   psp_samples(Download)
#!/usr/bin/python
""" Wrapper for PyGame, which exports the pspnet API on non-PSP systems. """
 
__author__ = 'Boris Buegling, <boris@icculus.org>'
import time, thread
from socket import gethostbyname, gethostname
 
def getIP():
  return gethostbyname(gethostname())
 
if __name__ == '__main__':
  print getIP()
 
def enumConfigs():

src/b/t/btqueue-HEAD/trunk/btqueue/BitQueue/launchmanycore_bittorrent.py   btqueue(Download)
from BitTorrent.zurllib import quote
from binascii import b2a_hex
from random import random, randrange
from socket import error, gethostbyname, gethostname
from BitTorrent.platform import bttime
from BitTorrent.btformats import check_peers
from urllib2 import Request,urlopen
    def _makeurl(self, peerid, port):
        url = ('info_hash=%s&peer_id=%s&port=%s&key=%s' %
                (quote(self.infohash), quote(peerid), str(port),
                 b2a_hex(''.join([chr(randrange(256)) for i in xrange(4)]))))
        try:
            url += '&local_ip=%s' % quote(gethostbyname(gethostname()))
        except:
    def _rerequest(self, url, peerid):
        get_thread().add_message(self.infohash,'ann: %s' % url)
        if self.config['ip']:
            try:
                url += '&ip=' + gethostbyname(self.config['ip'])
            except Exception, e:
                self.errorfunc(WARNING, _("Problem connecting to tracker, gethostbyname failed - ") + str(e))

src/c/i/circuits-1.2.1/circuits/net/sockets.py   circuits(Download)
from errno import *
from _socket import socket as SocketType
from collections import defaultdict, deque
from socket import gethostname, gethostbyname
 
from circuits.net.pollers import Select as DefaultPoller
from circuits.core import handler, Event, Component
    def __init__(self, bind=None, channel=channel, **kwargs):
        super(Client, self).__init__(channel=channel, **kwargs)
 
        if type(bind) is int:
            self.bind = (gethostbyname(gethostname()), bind)
        elif type(bind) is str and ":" in bind:
            host, port = bind.split(":")
    def __init__(self, bind, ssl=False, channel=channel, **kwargs):
        super(Server, self).__init__(channel=channel)
 
        if type(bind) is int:
            self.bind = (gethostbyname(gethostname()), bind)
        elif type(bind) is str and ":" in bind:
            host, port = bind.split(":")

src/b/t/btqueue-HEAD/btqueue/BitQueue/launchmanycore_bittorrent.py   btqueue(Download)
from BitTorrent.zurllib import quote
from binascii import b2a_hex
from random import random, randrange
from socket import error, gethostbyname, gethostname
from BitTorrent.platform import bttime
from BitTorrent.btformats import check_peers
from urllib2 import Request,urlopen
    def _makeurl(self, peerid, port):
        url = ('info_hash=%s&peer_id=%s&port=%s&key=%s' %
                (quote(self.infohash), quote(peerid), str(port),
                 b2a_hex(''.join([chr(randrange(256)) for i in xrange(4)]))))
        try:
            url += '&local_ip=%s' % quote(gethostbyname(gethostname()))
        except:
    def _rerequest(self, url, peerid):
        get_thread().add_message(self.infohash,'ann: %s' % url)
        if self.config['ip']:
            try:
                url += '&ip=' + gethostbyname(self.config['ip'])
            except Exception, e:
                self.errorfunc(WARNING, _("Problem connecting to tracker, gethostbyname failed - ") + str(e))

src/b/t/btqueue-HEAD/trunk/btqueue/BitQueue/ip2cc.py   btqueue(Download)
            if is_IP(addr):
                ip = addr_str = addr
            else:
                from socket import gethostbyname, gaierror
                try:
                    ip = gethostbyname(addr)
                except gaierror, exc:

src/b/t/btqueue-HEAD/btqueue/BitQueue/ip2cc.py   btqueue(Download)
            if is_IP(addr):
                ip = addr_str = addr
            else:
                from socket import gethostbyname, gaierror
                try:
                    ip = gethostbyname(addr)
                except gaierror, exc:

src/b/t/btqueue-HEAD/trunk/btqueue/BitTornado/BT1/Rerequester.py   btqueue(Download)
# Written by Bram Cohen
# modified for multitracker operation by John Hoffman
# see LICENSE.txt for license information
 
from BitTornado.zurllib import urlopen, quote
from urlparse import urlparse, urlunparse
from socket import gethostbyname
from btformats import check_peers
from BitTornado.bencode import bdecode
from threading import Thread, Lock
from cStringIO import StringIO
from traceback import print_exc
from socket import error, gethostbyname, gethostname
        self.url = ('?peer_id=%s&info_hash=%s&port=%s' %
            (quote(myid), quote(infohash), str(port)))
        try:
            self.url += '&local_ip=%s' % gethostbyname(gethostname())
        except:
            pass
        self.ip = ip
    def _rerequest(self, s, callback):
        try:
            def fail (self = self, callback = callback):
                self._fail(callback)
            if self.ip:
                try:
                    s += '&ip=' + gethostbyname(self.ip)

src/b/t/btqueue-HEAD/btqueue/BitTornado/BT1/Rerequester.py   btqueue(Download)
# Written by Bram Cohen
# modified for multitracker operation by John Hoffman
# see LICENSE.txt for license information
 
from BitTornado.zurllib import urlopen, quote
from urlparse import urlparse, urlunparse
from socket import gethostbyname
from btformats import check_peers
from BitTornado.bencode import bdecode
from threading import Thread, Lock
from cStringIO import StringIO
from traceback import print_exc
from socket import error, gethostbyname, gethostname
        self.url = ('?peer_id=%s&info_hash=%s&port=%s' %
            (quote(myid), quote(infohash), str(port)))
        try:
            self.url += '&local_ip=%s' % gethostbyname(gethostname())
        except:
            pass
        self.ip = ip
    def _rerequest(self, s, callback):
        try:
            def fail (self = self, callback = callback):
                self._fail(callback)
            if self.ip:
                try:
                    s += '&ip=' + gethostbyname(self.ip)

src/z/e/zenoss-HEAD/trunk/Products/ZenStatus/zenping.py   zenoss(Download)
import os.path
import sys
import re
from socket import gethostbyname, getfqdn, gaierror
import time
import logging
log = logging.getLogger("zen.zenping")
def findIp():
    try:
        return gethostbyname(getfqdn())
    except gaierror:
        # find the first non-loopback interface address
        ifconfigs = ['/sbin/ifconfig',
                     '/usr/sbin/ifconfig',

src/c/i/circuits-1.2.1/circuits/core/bridge.py   circuits(Download)
"""
 
from cPickle import dumps, loads
from socket import gethostname, gethostbyname
 
from circuits import handler, Event, Component
from circuits.net.sockets import Client, Server, UDPServer as DefaultTransport
 
        if hasattr(self.transport, "address"):
            if self.transport.address in ["", "0.0.0.0"]:
                address = gethostbyname(gethostname())
                self.ourself = (address, self.transport.port)
            else:
                self.ourself = self.transport.bind
        else:
            self.ourself = (gethostbyname(gethostname()), 0)

  1 | 2 | 3 | 4 | 5 | 6 | 7  Next