You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Aleksandr Krasnoperov <ak...@65gb.net> on 2013/09/18 12:20:12 UTC

Apache thrift and android. TTransportException.

Hi.

The problem with apache thrift work in android.

I am using apache thrift. There is a php server. There is a client for java
( Simple java project). Everything is working.

When I create a client on Android, the connection to the server is
successful. The functions are processed on the server, but in the
application I get the error :

TTransportException: No more data available.

Transport - http. Protocol - binary.

Code to create a client (and the same in a simple java project and android
project):

TTransport transport = new THttpClient
("http://test.../PhpServer.php");TProtocol protocol = new
TBinaryProtocol (transport);TestService.Client client = new
TestService.Client (protocol);
transport.open ();try {
    client.EchoI32 (4);} Catch (SysException e) {
    e.printStackTrace ();} Catch (TException e) {
    e.printStackTrace ();}

LogCat:

09-09 14:43:07.107: W/System.err(31729):
org.apache.thrift.transport.TTransportException: No more data
available.09-09 14:43:07.107: W/System.err(31729):  at
org.apache.thrift.transport.THttpClient.read(THttpClient.java:190)09-09
14:43:07.107: W/System.err(31729):  at
org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)09-09
14:43:07.107: W/System.err(31729):  at
org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:359)09-09
14:43:07.107: W/System.err(31729):  at
org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:278)09-09
14:43:07.107: W/System.err(31729):  at
org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:185)09-09
14:43:07.107: W/System.err(31729):  at
org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)09-09
14:43:07.107: W/System.err(31729):  at
com.test.protocol.TestService$Client.recv_EchoI32(TestService.java:912)