Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] How to get remote IP address as String in WebSocketListener?

Hello, would calling

    String ip = mSession.getRemoteAddress().getAddress().getHostAddress();

be a good way of getting the remote IP address in the onWebSocketText callback of a custom WebSocketListener implementation?

I am asking because -

1) Is calling 3 methods necessary or maybe there is a shortcut?

2) Should (mSession != null) be checked first as in the example

http://www.eclipse.org/jetty/documentation/current/jetty-websocket-api-listener.html   ?

Thank you
Alex



Back to the top