thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stream <stream1...@gmail.com>
Subject Re: how can i get the client's ip from the server of thrift
Date Mon, 24 Oct 2011 03:18:31 GMT
i've just look at the TNonBlockingServerSocket and found its hard to put the client ip out.

protected TNonblockingSocket acceptImpl() throws TTransportException {
      if (serverSocket_ == null) {
        throw new TTransportException(TTransportException.NOT_OPEN, "No underlying server
socket.");
      }
      try {
        SocketChannel socketChannel = serverSocketChannel.accept();
        if (socketChannel == null) {
          return null;
        }
	// here, how can i get the socketChannel, that seems its best the way by event flowing...
        TNonblockingSocket tsocket = new TNonblockingSocket(socketChannel);
        tsocket.setTimeout(clientTimeout_);
        return tsocket;
      } catch (IOException iox) {
        throw new TTransportException(iox);
      }
    }


On 2011-10-24, at 上午10:39, Mike Riley wrote:

> It looks like subclassing TServerSocket/TNonBlockingServerSocket (and
> your chosen server class) will allow you to access the IP address (or
> hostname) pretty easily right from the Sockets they manage so that's
> what you're shooting for I guess...
> 
> On Sun, Oct 23, 2011 at 10:15 PM, stream <stream1984@gmail.com> wrote:
>> well, is my fault ,not clear the description .
>> the library is Java... thank Mike firstly...
>> 
>> On 2011-10-24, at 上午9:20, Mike Riley wrote:
>> 
>>> plac
>> 
>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message