예제 #1
0
def protobuf_simple_version(sock):

    print "==>protobuf_simple_version"
    sreq = SimpleRequest()
    sreq.youpla = u'hello'

    sock.send(sreq.SerializeToString())
    response = sock.recv()
    sresp = SimpleResponse()
    sresp.ParseFromString(response)

    print "server response:", sresp.boum
예제 #2
0
파일: Main.py 프로젝트: GustavePate/distark
def dothejob(ok, bla):

    context = zmq.Context.instance()
    sock = context.socket(zmq.REQ)
    sock.bind('tcp://*:8081')
    # sock.send(' '.join(sys.argv[1:]))
    # response = sock.recv()
    # print "response:",response

    sreq = SimpleRequest()
    sreq.req.servicename = u'SimpleRequest'
    sreq.req.caller = u'me_the_client'
    sreq.youpla = u'hello'

    sock.send(sreq.SerializeToString())
    response = sock.recv()
    sresp = SimpleResponse()
    sresp.ParseFromString(response)

    print "server response:", sresp.boum, "to", sresp.resp.req.caller