Hello all
I have `api.thrift` file:
-----
service API {
void ping()
}
-----
and I have very simple twisted server based on twisted server from tutorial:
------
import sys
sys.path.append('./gen-py.twisted')
from api import API
from api.ttypes import *
from zope.interface import implements
from twisted.internet import reactor
from thrift.transport import TTwisted
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
class ApiHandler:
implements(API.Iface)
def __init__(self):
self.log = {}
def ping(self):
print 'ping()'
if __name__ == '__main__':
handler = ApiHandler()
processor = API.Processor(handler)
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
server = reactor.listenTCP(9090,
TTwisted.ThriftServerFactory(processor,
pfactory), interface="127.0.0.1")
reactor.run()
------
I can successfull run this server and connect to it from python-based
client.
But when I trying connect from PHP I got this:
------
PHP Fatal error: Uncaught exception 'TTransportException' with message
'TSocket read 0 bytes' in /home/italy/src/tmp/php1/transport/TSocket.php:263
Stack trace:
#0 /home/italy/src/tmp/php1/transport/TTransport.php(87): TSocket->read(4)
#1 /home/italy/src/tmp/php1/transport/TBufferedTransport.php(109):
TTransport->readAll(4)
#2 /home/italy/src/tmp/php1/protocol/TBinaryProtocol.php(300):
TBufferedTransport->readAll(4)
#3 /home/italy/src/tmp/php1/protocol/TBinaryProtocol.php(192):
TBinaryProtocol->readI32(NULL)
#4 /home/italy/src/tmp/php1/packages/api/API.php(61):
TBinaryProtocol->readMessageBegin(NULL, 0, 0)
#5 /home/italy/src/tmp/php1/packages/api/API.php(31): APIClient->recv_ping()
#6 /home/italy/src/tmp/php1/client.php(20): APIClient->ping()
#7 {main}
thrown in /home/italy/src/tmp/php1/transport/TSocket.php on line 263
-----
Also I got the same error when run twisted server and php-client from
tutorial.
Anybody works with it? Have you any ideas how connect twisted and php?
--
Thanks!