Exemplo n.º 1
0
    def nextMsg(self, *args, **kw):
        """Convenience function that handles any buffering required to
        read the next full message.  This is overloaded so we can always
        unpack the pickled message."""

        # get the next message delimited by the delim character
        msg = ServerClientSocket.nextMsg(self, self.delimiter, *args, **kw)
        
        try:
            data = pickle.loads(msg)
            #if random.randint(1,100) == 1:
            #    raise pickle.BadPickleGet, 'test bad pickle!'
            return data
        except EOFError, e:
            return {}
Exemplo n.º 2
0
    def nextMsg(self, *args, **kw):
        """Convenience function that handles any buffering required to
        read the next full message.  This is overloaded so we can always
        unpack the pickled message."""

        # get the next message delimited by the delim character
        msg = ServerClientSocket.nextMsg(self, self.delimiter, *args, **kw)
        
        try:
            data = pickle.loads(msg)
            #if random.randint(1,100) == 1:
            #    raise pickle.BadPickleGet, 'test bad pickle!'
            return data
        except EOFError, e:
            return {}
Exemplo n.º 3
0
 def __init__(self, sock, address, **kw):
     """Same init.  Just grab delimiter."""
     ServerClientSocket.__init__(self, sock, address, **kw)
Exemplo n.º 4
0
 def send(self, msg, *args, **kw):
     """All messages are first packed by pickle and then delimited."""
     
     pickmsg = pickle.dumps(msg) + self.delimiter
     #print 'sending %d bytes' % len(pickmsg)
     ServerClientSocket.send(self, pickmsg, *args, **kw)
Exemplo n.º 5
0
 def __init__(self, sock, address, **kw):
     """Same init.  Just grab delimiter."""
     ServerClientSocket.__init__(self, sock, address, **kw)
Exemplo n.º 6
0
 def send(self, msg, *args, **kw):
     """All messages are first packed by pickle and then delimited."""
     
     pickmsg = pickle.dumps(msg) + self.delimiter
     #print 'sending %d bytes' % len(pickmsg)
     ServerClientSocket.send(self, pickmsg, *args, **kw)