I'm working on the Java security and enabled security manager with the custom grant policy file. I'm facing issue related to socket permission. My application is listening to localhost on the port '3333', for which listen socket permission is granted in the policy file. For this port I created ServerSocket by giving argument Inet4Address.getLocalHost(). But when my client running on different node trying to send packets to my application on the port '3333' it throws connection reset exception. And the server side when it's trying to accept on the socket throws security check exception capturing client IP with the port and the action is (connect, resolve). java.security.AccessControlException: access denied ("java.net.SocketPermission" "XX.XXX.XXX.10:52610" "accept,resolve") Server IP - XX.XXX.XXX.11 Client IP - XX.XXX.XXX.10
I can't add client IP and port in the grant policy file at the server side because the port range varies and also may be some other client can try to send packet to the server on the port '3333'. Could please provide me some inputs on the same, also how it can be handled in the case of web server i.e. Tomact.