# Path: pyDAPLink/socket/socket.py
# class Connection(object):
#     def send(self, data):
#         return
# 
#     def recv(self, size=2**16):
#         return
# 
#     def settimeout(self, timeout):
#         return
# 
#     def isalive(self):
#         return
# 
#     def shutdown(self):
#         return
# 
#     def close(self):
#         return
# 
# class Server(object):
#     def __init__(self, address=None, timeout=None):
#         self.address = address
#     
#     def open(self):
#         return
# 
#     def accept(self):
#         return
# 
#     def settimeout(self):
#         return
# 
#     def isalive(self):
#         return
# 
#     def shutdown(self):
#         return
# 
#     def close(self):
#         return
# 
# class Client(Connection):
#     def __init__(self, address=None, timeout=None):
#         self.address = address
# 
#     def open(self):
#         return
# 
# class Socket(object):
#     name = None
#     available = False
# 
#     @staticmethod
#     def addrisvalid(address):
#         return False
# 
#     Client = Client
#     Server = Server
# 
# Path: pyDAPLink/utility/socket_pair.py
# def socket_pair():
#     if hasattr(socket, 'socketpair'):
#         return socket.socketpair()
# 
#     server = socket.socket()
#     server.bind(('localhost', 0))
#     server.listen(1)
# 
#     a = socket.socket()
#     a.setblocking(False)
# 
#     try:
#         a.connect(server.getsockname())
#     except socket.error as err:
#         if err.errno not in (errno.EWOULDBLOCK, errno.EINPROGRESS):
#             raise
#     
#     b, _ = server.accept()
# 
#     return a, b


import os
import stat
import socket
from select import select
from .socket import Connection, Server, Client, Socket
from ..utility import socket_pair
            self._isalive = False

        return data

    def isalive(self):
        return self._isalive

    def shutdown(self):
        self._isalive = False
        try:
            self._socket.shutdown(socket.SHUT_RDWR)
        except socket.error:
            pass

    def close(self):
        self._socket.close()

class UnixClient(UnixConnection, Client):
    def __init__(self, address='/tmp/pydaplink/socket', timeout=None):
        self.address = address
        self._isalive = False
        self._timeout = timeout

    def open(self):
        conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        conn.settimeout(self._timeout)
        conn.connect(self.address)

        UnixConnection.__init__(self, conn)


# Path: pyDAPLink/socket/socket.py
# class Connection(object):
#     def send(self, data):
#         return
# 
#     def recv(self, size=2**16):
#         return
# 
#     def settimeout(self, timeout):
#         return
# 
#     def isalive(self):
#         return
# 
#     def shutdown(self):
#         return
# 
#     def close(self):
#         return
# 
# class Server(object):
#     def __init__(self, address=None, timeout=None):
#         self.address = address
#     
#     def open(self):
#         return
# 
#     def accept(self):
#         return
# 
#     def settimeout(self):
#         return
# 
#     def isalive(self):
#         return
# 
#     def shutdown(self):
#         return
# 
#     def close(self):
#         return
# 
# class Client(Connection):
#     def __init__(self, address=None, timeout=None):
#         self.address = address
# 
#     def open(self):
#         return
# 
# class Socket(object):
#     name = None
#     available = False
# 
#     @staticmethod
#     def addrisvalid(address):
#         return False
# 
#     Client = Client
#     Server = Server
# 
# Path: pyDAPLink/utility/socket_pair.py
# def socket_pair():
#     if hasattr(socket, 'socketpair'):
#         return socket.socketpair()
# 
#     server = socket.socket()
#     server.bind(('localhost', 0))
#     server.listen(1)
# 
#     a = socket.socket()
#     a.setblocking(False)
# 
#     try:
#         a.connect(server.getsockname())
#     except socket.error as err:
#         if err.errno not in (errno.EWOULDBLOCK, errno.EINPROGRESS):
#             raise
#     
#     b, _ = server.accept()
# 
#     return a, b


# Path: pyDAPLink/socket/unix_socket.py
import os
import stat
import socket
from select import select
from .socket import Connection, Server, Client, Socket
from ..utility import socket_pair

            self._isalive = False

        return data

    def isalive(self):
        return self._isalive

    def shutdown(self):
        self._isalive = False
        try:
            self._socket.shutdown(socket.SHUT_RDWR)
        except socket.error:
            pass

    def close(self):
        self._socket.close()

class UnixClient(UnixConnection, Client):
    def __init__(self, address='/tmp/pydaplink/socket', timeout=None):
        self.address = address
        self._isalive = False
        self._timeout = timeout

    def open(self):
        conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        conn.settimeout(self._timeout)
        conn.connect(self.address)

        UnixConnection.__init__(self, conn)


class UnixServer(Server):