Skip Montanaro: modify test_socket.py to listen/connect using loopback addr
This commit is contained in:
parent
be2211e940
commit
1bfdc78c84
|
@ -97,7 +97,7 @@ try:
|
|||
if not canfork or os.fork():
|
||||
# parent is server
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind((hostname, PORT))
|
||||
s.bind(("127.0.0.1", PORT))
|
||||
s.listen(1)
|
||||
if verbose:
|
||||
print 'parent accepting'
|
||||
|
@ -133,7 +133,7 @@ try:
|
|||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
if verbose:
|
||||
print 'child connecting'
|
||||
s.connect((hostname, PORT))
|
||||
s.connect(("127.0.0.1", PORT))
|
||||
msg = 'socket test'
|
||||
s.send(msg)
|
||||
data = s.recv(1024)
|
||||
|
|
Loading…
Reference in New Issue