Språk

SocketPermission(String, String) Constructor

Definition

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")]
public SocketPermission(string? host, string? action);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")>]
new Java.Net.SocketPermission : string * string -> Java.Net.SocketPermission

Parameters

host
String

the hostname or IP address of the computer, optionally including a colon followed by a port or port range.

action
String

the action string.

Attributes

Remarks

Creates a new SocketPermission object with the specified actions. The host is expressed as a DNS name, or as a numerical IP address. Optionally, a port or a portrange may be supplied (separated from the DNS name or IP address by a colon). To specify the local machine, use "localhost" as the host. Also note: An empty host String ("") is equivalent to "localhost". The actions parameter contains a comma-separated list of the actions granted for the specified host (and port(s)). Possible actions are "connect", "listen", "accept", "resolve", or any combination of those. "resolve" is automatically added when any of the other three are specified. Examples of SocketPermission instantiation are the following:

nr = new SocketPermission("www.example.com", "connect");
nr = new SocketPermission("www.example.com:80", "connect");
nr = new SocketPermission("*.example.com", "connect");
nr = new SocketPermission("*.edu", "resolve");
nr = new SocketPermission("204.160.241.0", "connect");
nr = new SocketPermission("localhost:1024-65535", "listen");
nr = new SocketPermission("204.160.241.0:1024-65535", "connect");

Java reference for java.net.SocketPermission.SocketPermission.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to