A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/070824.html below:

How to get socket errors from 'connect'?

How to get socket errors from 'connect'? How to get socket errors from 'connect'?Doug Fort dougfort at downright.com
Thu Apr 12 14:01:44 EDT 2001
>

Try catching 'socket.error'.  It includes a tuple  of  the form (errocode,
explanation)


> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> try:
>     val=sock.connect((url, port))

    except socket.error, errortuple:
        print "socket error %s %s" % errortuple
         .....

>
> except Exception:
>     print 'no luck connecting'
>     sock.close()
>     del sock
>     print val
>     sys.exit()
>

--
Doug Fort (dougfort at downright.com)
Senior Meat Manager
Downright Software LLC
http://www.dougfort.net




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4