'Send a pickled string to the socket.
This function allows for partial sends which can happen when the
network is busy.'

def send(self, s):

    if (self.sock is None):
        self.createSocket()
    if self.sock:
        try:
            self.sock.sendall(s)
        except OSError:
            self.sock.close()
            self.sock = None
