Code: Select all
>>> dir(socket.socket)
['__class__', '__name__', 'close', 'send', '__bases__', '__del__', 'accept', 'bind', 'connect', 'listen', 'recv', 'recvfrom', 'sendto', 'setblocking',
'setsockopt', 'settimeout']
>>> dir(socket.socket.settimeout)
['__class__']
>>> host = '10.128.0.148'
>>> NTP_QUERY = bytearray(48)
>>> NTP_QUERY[0] = 0x1b
>>> addr = socket.getaddrinfo(host,123)[0][-1]
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.settimeout(5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 107] ENOTCONN