Ticket #3831: getsockfail.py

File getsockfail.py, 331 bytes (added by PenguinOfDoom, 5 years ago)

minimal example

Line 
1from socket import *
2
3i = 1
4while 1:
5    server = socket(AF_INET, SOCK_STREAM)
6    server.bind(('127.0.0.1', 0))
7    server.listen(1)
8    h, p = server.getsockname()
9    if h != '127.0.0.1':
10        print 'Wrong address! Expected 127.0.0.1, got %s. Port %s. Iteration #%s.' % (h, p, i)
11        break
12    server.close()
13    i += 1
14