Java Socket getLocalSocketAddress() methodThe getLocalSocketAddress() method of Java Socket class returns the address of the endpoint to which this socket is bound. This method will continue to return an InetSocketAddress even after the socket is closed. SyntaxParameterNA ReturnThe getLocalSocketAddress() method returns:
Example 1Test it NowOutput: Local Port number: 1085 Local socket address: /127.0.0.1:1085 Example 2Test it NowOutput: Local Port number: 1085 Local socket address: /192.168.0.102:1085 Example 3Test it NowOutput: Local socket address: null Next TopicJava Socket Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India