Hello,

For this, you will have to depend on the fact that Flight is currently 
implemented with gRPC. This means:
 1. Take a dependency on flight-grpc,
 2. Configure a plain gRPC server following the grpc-java docs,
 3. Add the Flight service to the gRPC server via FlightGrpcUtils[1]
Then you can get the peer address from grpc-java by installing a gRPC 
interceptor that reads the address and places it in the gRPC context. From 
within the FlightProducer, you can then access the gRPC context. This is 
described briefly at [2] and you can see a short (incomplete) code snippet at 
[3].

Maybe Flight could pull this info for you, this was done for C++/Python at [4] 
- though it would be an opaque/transport-dependent string.

[1]: 
https://arrow.apache.org/docs/java/reference/org/apache/arrow/flight/FlightGrpcUtils.html#createFlightService-org.apache.arrow.memory.BufferAllocator-org.apache.arrow.flight.FlightProducer-org.apache.arrow.flight.auth.ServerAuthHandler-java.util.concurrent.ExecutorService-
[2]: https://stackoverflow.com/a/52633506
[3]: https://github.com/grpc/grpc-java/issues/5489
[4]: https://issues.apache.org/jira/browse/ARROW-9175

Best,
David

On Mon, Sep 13, 2021, at 09:02, Mohamed Abdelhakem wrote:
> in Java Arrow Flight protocol, I would like to access the client address and 
> port whenever a FlightClient connects to FlightServer. 
> is there a way to do so?
> Thanks in advance
> 

Reply via email to