Jean, this is a known bug/limitation. See
https://issues.apache.org/jira/browse/THRIFT-1025

Diwaker

On Sun, Aug 12, 2012 at 11:18 AM, Jean-Sebastien Delfino
<[email protected]> wrote:
> Hi,
>
> Any thoughts?
>
> Thanks...
>
> - Jean-Sebastien
>
> On Wed, Aug 1, 2012 at 9:37 AM, Jean-Sebastien Delfino <[email protected]
>> wrote:
>
>> Hi all,
>>
>> I'm trying to use Thrift for cross-language invocations and need to bind
>> my server to a specific host IP address instead of the wildcard address (as
>> I have multiple ethernet interfaces on my box, but don't want to listen on
>> all of them).
>>
>> TServerSocket.cpp is currently coded to bind to the wildcard address, like
>> this:
>> // Wildcard address
>> error = getaddrinfo(NULL, port, &hints, &res0);
>>
>> I'm thinking about adding a host parameter to TServerSocket to
>> *optionally* bind to a specific host address, and allow a server to be set
>> up like this:
>> int main(int argc, char **argv) {
>>   const string host = "myserver.example.com";
>>   int port = 9090;
>>   shared_ptr handler(new UserStorageHandler());
>>   shared_ptr processor(new UserStorageProcessor(handler));
>>   // You can now specifying both host and port
>>   shared_ptr serverTransport(new TServerSocket(host, port));
>>   shared_ptr transportFactory(new TBufferedTransportFactory());
>>   shared_ptr protocolFactory(new TBinaryProtocolFactory());
>>   TSimpleServer server(processor, serverTransport, transportFactory,
>> protocolFactory);
>>   server.serve();
>>   return 0;
>> }
>>
>> I've pushed a strawman change to a Github branch [1] to show what it'd
>> look like, and have a few questions:
>>
>> - Does that look like a reasonable addition?
>>
>> - Which test cases should I adapt to use that new parameter? or should I
>> add new separate test cases for this?
>>
>> - I'd have to make similar changes to TSSLServerSocket and
>> TNonblockingServer too I guess (as that server socket setup code seems
>> duplicated in a few places), then later on add an option to the Thrift code
>> generator to configure the host in generated server skeletons, right? Can
>> you think of any other adjustments I'd have to make?
>>
>> Thanks!
>>
>> [1]
>> https://github.com/jsdelfino/thrift/commit/35ece91f0cba9b875b036c473e0566e9b40fa8eb
>>
>> - Jean-Sebastien
>>



-- 
http://maginatics.com

Reply via email to