How could I catch socket.error: [Errno 111] Connection refused
exception ?
try:
senderSocket.send("Hello")
except ?????:
print "catch !"
How could I catch socket.error: [Errno 111] Connection refused
exception ?
try:
senderSocket.send("Hello")
except ?????:
print "catch !"
By catching all
socket.error
exceptions, and re-raising it if theerrno
attribute is not equal to 111. Or, better yet, use theerrno.ECONNREFUSED
constant instead: