If your code is an applet or runs under java security, you need to explicitly grant it permission to perform any action.
In order for access to the resource to be allowed for the applet (or the application working with the security manager), the corresponding permission must be explicitly granted to the code trying to gain access.
By default, your code does not have permission on the socket. Your permission states that your code has permission to accept the connection, connect, and only allow the host with IP 192.168.1.1 on port 31337 .
The actions of accept and connect are obvious.
The action "allow" is implied when any of the other actions is present. The Solution action refers to the search services for host names and IP addresses.
The listen action only makes sense when used with localhost.
The difference between listening and accepting is that listening means "be ready to connect and see if there is a connection wait" and accept the values "ok, accept it".
See docs for permissions in java 7. and java.net.SocketPermission java docs
source share