added a proper header and switched to use TBinaryProtocolAcceleratedFactory, added some debug print msgs

master
Ray Slakinski 2012-05-18 14:44:17 -04:00
parent c945aba23f
commit 769f960401
1 changed files with 6 additions and 1 deletions

7
server.py 100644 → 100755
View File

@ -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)