Skip to content

Instantly share code, notes, and snippets.

@bloodywing bloodywing/
Last active Aug 29, 2015

What would you like to do?
<_read[server] (<socket._socketobject object at 0x1fca8a0> )>
<read[server] (<socket._socketobject object at 0x1fca8a0>, '\x91\xdc\x00\x18\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x91\xdc\x00\x18\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17' )>
<error[server] (<class 'msgpack.exceptions.ExtraData'>, ExtraData(), [' File "/home/pierre/src/circuits/circuits/core/", line 555, in _dispatcher\n value = handler(*eargs, **ekwargs)\n', ' File "", line 55, in read\n data = msgpack.unpackb(data.strip())\n', ' File "_unpacker.pyx", line 123, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:123)\n'] handler=<bound method of <Server/server 27602:MainThread (queued=2) [R]>>, fevent=<read[server] (<socket._socketobject object at 0x1fca8a0>, '\x91\xdc\x00\x18\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x91\xdc\x00\x18\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17' )>)>
ERROR <handler[*.read] (> (<read[server] (<socket._socketobject object at 0x1fca8a0>, '\x91\xdc\x00\x18\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x91\xdc\x00\x18\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17' )>) {<class 'msgpack.exceptions.ExtraData'>}: unpack(b) received extra data.
File "/home/pierre/src/circuits/circuits/core/", line 555, in _dispatcher
value = handler(*eargs, **ekwargs)
File "", line 55, in read
data = msgpack.unpackb(data.strip())
File "_unpacker.pyx", line 123, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:123)
# -*- coding: utf-8 -*-
Created on Mon Mar 3 08:29:16 2014
@author: pierre
import argparse
from random import randint
import msgpack
import pickle
from circuits import handler, Component, Debugger, Timer, Event
from circuits.node import Node, remote
from import connect, write
from import TCPClient, TCPServer
class my_event(Event):
""" my event """
class Client(Component):
def ready(self, *args):
print("Client ready!")
def connected(self, host, port):
Timer(1, my_event(), persist=True).register(self)
@handler('my_event', channels='*')
def my_event(self):
data = []
data.append(range(0, 24))
#packed = pickle.dumps(data)
packed = msgpack.packb(data)
class Server(Component):
def init(self):
bind = ('localhost', 8001)
def read(self, sock, data):
#data = pickle.loads(data.strip())
data = msgpack.unpackb(data.strip())
# circuits classes done
def main():
argparser = argparse.ArgumentParser(description='This is a bloody script')
argparser.add_argument('-c', '--client', help='The Client', action='store_true')
argparser.add_argument('-s', '--server', help='The Server', action='store_true')
args = argparser.parse_args()
if args.client:
client = Client() + Debugger()
node = Node().register(client)
node.add('test', 'localhost', 8001)
if args.server:
(Server() + Debugger()).run()

This comment has been minimized.

Copy link
Owner Author

bloodywing commented Mar 3, 2014

Line 44 and 45 is intended

python -c
python -s


This comment has been minimized.

Copy link

prologic commented Mar 3, 2014

The only way to avoid the buffering occuring internally at lines 44/45 is to do something like:

    yield, 'client')
    yield, 'client')

If this doesn't work you could try:, 'client')
    yield self.wait("_write"), 'client')
    yield self.wait("_write")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.