summaryrefslogtreecommitdiffstats
path: root/Doc/library/socket.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/socket.rst')
-rw-r--r--Doc/library/socket.rst30
1 files changed, 15 insertions, 15 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index c2e3d91..f399dae 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -797,17 +797,17 @@ sends traffic to the first one connected successfully. ::
socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
af, socktype, proto, canonname, sa = res
try:
- s = socket.socket(af, socktype, proto)
+ s = socket.socket(af, socktype, proto)
except socket.error as msg:
- s = None
- continue
+ s = None
+ continue
try:
- s.bind(sa)
- s.listen(1)
+ s.bind(sa)
+ s.listen(1)
except socket.error as msg:
- s.close()
- s = None
- continue
+ s.close()
+ s = None
+ continue
break
if s is None:
print('could not open socket')
@@ -832,16 +832,16 @@ sends traffic to the first one connected successfully. ::
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
- s = socket.socket(af, socktype, proto)
+ s = socket.socket(af, socktype, proto)
except socket.error as msg:
- s = None
- continue
+ s = None
+ continue
try:
- s.connect(sa)
+ s.connect(sa)
except socket.error as msg:
- s.close()
- s = None
- continue
+ s.close()
+ s = None
+ continue
break
if s is None:
print('could not open socket')