From 769f9604013c8603b1a0c09b239d6eb483d4398e Mon Sep 17 00:00:00 2001 From: Ray Slakinski Date: Fri, 18 May 2012 14:44:17 -0400 Subject: [PATCH] added a proper header and switched to use TBinaryProtocolAcceleratedFactory, added some debug print msgs --- server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 server.py diff --git a/server.py b/server.py old mode 100644 new mode 100755 index bd6b9c8..7ab0644 --- a/server.py +++ b/server.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + from helloworld import HelloWorld from helloworld.ttypes import * from helloworld.constants import * @@ -13,9 +16,11 @@ class HelloWorldHandler: self.log = {} def ping(self): + print 'Recieved Ping... returning pong' return "pong" def sayHello(self, msg): + print 'Recieved hello msg: %s' % msg if msg.lang in ('kp', 'kr'): hello = HELLO_IN_KOREAN elif msg.lang == 'fr': @@ -30,7 +35,7 @@ handler = HelloWorldHandler() processor = HelloWorld.Processor(handler) transport = TSocket.TServerSocket('localhost', port=9090) tfactory = TTransport.TBufferedTransportFactory() -pfactory = TBinaryProtocol.TBinaryProtocolFactory() +pfactory = TBinaryProtocol.TBinaryProtocolAcceleratedFactory() server = TServer.TSimpleServer(processor, transport, tfactory, pfactory)