You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Sriram V <ma...@gmail.com> on 2012/04/26 14:00:45 UTC

Could not connect to localhost from client!

Hello

I am a newbie to Thrift.

I am trying to develop a thrift based service. The service implementation
is in Java and the client is in Python. I am able to bring the server up
and running on a specific port. When I am trying to start the python
client, there's an exception with the message "could not connect to
localhost:<portnumber>". I tried switching to some other unused ports.
Result is the same. I am on Ubuntu 11.x.

Any pointers would help!

Thanks!

-- 
br, Sriram

Re: Could not connect to localhost from client!

Posted by Nathaniel Cook <nv...@gmail.com>.
To debug it first see if the java server is listening on the desired port:

netstat -nap | grep <port>

Check if you see a java process listening on the port.

Then check if you can connect to the port:

nc localhost <port>

If the command waits on stdin then you were able to connect. If both
of these work then check your that your thrift client and server are
talking with the same protocols and transports. If the java service
expects a FramedTransport then the python client must also use a
FramedTransport (I believe you can pass -f to the python client to
make it use a framed transport if you are using the generated python
client).

If all of these things look good then give us some more details.

Nathaniel Cook


On Thu, Apr 26, 2012 at 6:00 AM, Sriram V <ma...@gmail.com> wrote:
> Hello
>
> I am a newbie to Thrift.
>
> I am trying to develop a thrift based service. The service implementation
> is in Java and the client is in Python. I am able to bring the server up
> and running on a specific port. When I am trying to start the python
> client, there's an exception with the message "could not connect to
> localhost:<portnumber>". I tried switching to some other unused ports.
> Result is the same. I am on Ubuntu 11.x.
>
> Any pointers would help!
>
> Thanks!
>
> --
> br, Sriram