I am trying to get the IP of a socket connection in string form.
I am using a framework, which returns the SocketAddress of the received message. How can i transform it to InetSocketAddress or InetAddress?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your certain that the object is an
InetSocketAddressthen simply cast it:You can then call the
getAddress()method oninetAddrto get theInetAddressobject associated with it.