Python _socket.gethostbyname_ex() Examples

The following are 6 code examples of _socket.gethostbyname_ex(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module _socket , or try the search function .
Example #1
Source File: test__socket.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_gethostbyname_ex(self):
        '''Tests _socket.gethostbyname_ex'''
        #sanity
        joe = _socket.gethostbyname_ex("localhost")[2]
        self.assertTrue("127.0.0.1" in joe)
        joe = _socket.gethostbyname_ex("127.0.0.1")[2]
        self.assertTrue("127.0.0.1" in joe)
        
        #negative
        self.assertRaises(_socket.gaierror, _socket.gethostbyname_ex, "should never work") 
Example #2
Source File: resolver_thread.py    From satori with Apache License 2.0 5 votes vote down vote up
def gethostbyname_ex(self, *args):
        return self.pool.apply(_socket.gethostbyname_ex, args) 
Example #3
Source File: test__socket.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_gethostbyname_ex(self):
        '''Tests _socket.gethostbyname_ex'''
        #sanity
        joe = _socket.gethostbyname_ex("localhost")[2]
        self.assertIn("127.0.0.1" , joe)
        joe = _socket.gethostbyname_ex("127.0.0.1")[2]
        self.assertIn("127.0.0.1", joe)

        #negative
        self.assertRaises(_socket.gaierror, _socket.gethostbyname_ex, "should never work") 
Example #4
Source File: resolver_thread.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def gethostbyname_ex(self, *args):
        return self.pool.apply(_socket.gethostbyname_ex, args) 
Example #5
Source File: resolver_thread.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def gethostbyname_ex(self, *args):
        return self.pool.apply(_socket.gethostbyname_ex, args) 
Example #6
Source File: resolver_thread.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def gethostbyname_ex(self, *args):
        return self.pool.apply(_socket.gethostbyname_ex, args)