I have a JAVA application which runs on Linux. I open a socket that binds to all IP. In production this is not acceptable.
$ netstat -ano | grep 104
tcp 0 0 0.0.0.0:104 0.0.0.0:* LISTEN off (0.00/0/0)
I which to do this:
$ netstat -ano | grep 104
tcp 0 viewer1.com:104 0.0.0.0:* LISTEN off (0.00/0/0)
Is this something I can change in my Linux box (red hat) or is it application specific. i.e. I have to modify my code?
Most likely, you’ll need to modify the Java application to specify a bind address.
The most commonly used API for server socket construction binds to all address by default. However, there is another that can bind to a specific address. There’s a small chance that the application is already using the latter constructor, and it’s just not configured with a value. If that’s the case, you just need to find out how to configure an address.