common.py 文件源码

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

项目:AnnotatedShadowSocks 作者: xuelangZF 项目源码 文件源码
def patch_socket():
    """ Bind inet_ntop and inet_pton function to socket module.

    socket.inet_pton and socket.inet_ntop are available only on most Unix platforms.
    Here we use custom function if there are no inet_pton or inet_ntop defined.

    Ref: https://docs.python.org/2/library/socket.html#socket.inet_pton
    """
    if not hasattr(socket, 'inet_pton'):
        socket.inet_pton = inet_pton

    if not hasattr(socket, 'inet_ntop'):
        socket.inet_ntop = inet_ntop
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号