hellow friends,
how can i get server port number by using java.
please give me exampls codes for this program.

"how can I get a house number if I know the streetname?"

In other words, you're not going to do that.The port number is a part of the address, without the address you're not going to get anywhere.

While you could try every possible port and see what happens, that's considered a hostile attack on a server and is more than likely to get you permanently blocked from accessing it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.