pvl/socket.py
changeset 17 9bd35c091f05
parent 14 80d9f73f379a
equal deleted inserted replaced
15:e699ed00fcf1 17:9bd35c091f05
     9 import errno
     9 import errno
    10 import select
    10 import select
    11 import socket
    11 import socket
    12 import urlparse
    12 import urlparse
    13 import logging; log = logging.getLogger('pvl.socket')
    13 import logging; log = logging.getLogger('pvl.socket')
       
    14 
       
    15 from socket import SOCK_STREAM
    14 
    16 
    15 def parse (url, port=None) :
    17 def parse (url, port=None) :
    16     """
    18     """
    17         Parse given string into host, port, path parts.
    19         Parse given string into host, port, path parts.
    18 
    20 
    56     # autodetect as AF_UNIX
    58     # autodetect as AF_UNIX
    57     if path and not family :
    59     if path and not family :
    58         family = socket.AF_UNIX
    60         family = socket.AF_UNIX
    59     
    61     
    60     if family == socket.AF_UNIX :
    62     if family == socket.AF_UNIX :
    61         raise ValueError("TODO: AF_UNIX is not yet supported", str)
    63         raise ValueError("TODO: AF_UNIX is not yet supported: %s" % (url, ))
    62 
    64 
    63     else : # AF_UNSPEC or AF_INET/AF_INET6
    65     else : # AF_UNSPEC or AF_INET/AF_INET6
    64         return connect_inet(socktype, host, port, family=family)
    66         return connect_inet(socktype, host, port, family=family)
    65 
    67 
    66 def connect_inet (socktype, host, port, family=None) :
    68 def connect_inet (socktype, host, port, family=None) :