myexc.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:python 作者: hienha 项目源码 文件源码
def myconnect(sock, host, port):
    '''myconnect(sock, host, port) -- attempt to make a network connection
    with the given socket and host-port pair; raises our new NetworkError
    exception and collates error number and reason.'''

    try:
        sock.connect(host, port)

    except socket.error, args:
        myargs = updArgs(args)        # convert inst to tuple
        if len(myargs) == 1:        # no #s on some errors
            myargs = (errno.ENXIO, myargs[0])

        raise NetworkError, \
            updArgs(myargs, host + ':' + str(port))


# myopen() --> file object
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号