The NetIORequest Class of the com.ms.security.permissions package represents a request to perform a network-related action.
public class NetIORequest implements ISecurityRequest { // Fields public static final int ACCEPT; public static final int CONNECT; public static final int LISTEN; public static final int MULTICAST; // Constructors public NetIORequest(int accesstype, String hostname); public NetIORequest(int accesstype, String hostname, int port); public NetIORequest(int accesstype, int port); public NetIORequest(int accesstype, InetAddress addr, int ttl); public NetIORequest(int accesstype, InetAddress addr); // Methods public PermissionID getPermissionID(); public String toString(); }
Use NetIORequest objects as the security request objects for parameterized security checks involving the networking I/O permission. The NetIOPermission.check method expects a NetIORequest object as its parameter.
This example shows how to use a NetIORequest object to perform a security check.
... // Create a NetIORequest that indicates that you want to // connect to the host 'any.thing.com'. NetIORequest sreq = new NetIORequest(NetIORequest.CONNECT, "any.thing.com"); // Check to see that all of your callers have the rights to // connect to that host. PolicyEngine.checkPermission(sreq); ...
For more information about checking networking permissions, see the PolicyEngine class and the NetIOPermission class.