| 777 |
rajveer |
1 |
from shop2020.thriftpy.test import TestService
|
|
|
2 |
from thrift.transport import TSocket, TTransport
|
|
|
3 |
from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
|
|
|
4 |
from thrift.server import TServer
|
|
|
5 |
from shop2020.test.TestServiceHandler import TestServiceHandler
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
host_name = 'localhost'
|
|
|
10 |
port = '9009'
|
|
|
11 |
|
|
|
12 |
def main():
|
|
|
13 |
host_name = 'localhost'
|
|
|
14 |
port = '9009'
|
|
|
15 |
|
|
|
16 |
handler = TestServiceHandler()
|
|
|
17 |
processor = TestService.Processor(handler)
|
|
|
18 |
transport = TSocket.TServerSocket(port)
|
|
|
19 |
tfactory = TTransport.TFramedTransportFactory()
|
|
|
20 |
pfactory = TBinaryProtocolFactory()
|
|
|
21 |
server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
|
|
|
22 |
print "Starting Test at, port "+ str(port)+" host "+host_name
|
|
|
23 |
server.serve()
|
|
|
24 |
print "Server functioning"
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
if __name__ == '__main__':
|
| 876 |
rajveer |
28 |
main()
|