Edit

Share via


SocketPermission Constructors

Definition

Initializes a new instance of the SocketPermission class.

Overloads

SocketPermission(PermissionState)

Initializes a new instance of the SocketPermission class that allows unrestricted access to the Socket or disallows access to the Socket.

SocketPermission(NetworkAccess, TransportType, String, Int32)

Initializes a new instance of the SocketPermission class for the given transport address with the specified permission.

SocketPermission(PermissionState)

Source:
SocketPermission.cs
Source:
SocketPermission.cs
Source:
SocketPermission.cs
Source:
SocketPermission.cs
Source:
SocketPermission.cs

Initializes a new instance of the SocketPermission class that allows unrestricted access to the Socket or disallows access to the Socket.

public:
 SocketPermission(System::Security::Permissions::PermissionState state);
public SocketPermission(System.Security.Permissions.PermissionState state);
new System.Net.SocketPermission : System.Security.Permissions.PermissionState -> System.Net.SocketPermission
Public Sub New (state As PermissionState)

Parameters

state
PermissionState

One of the PermissionState values.

Remarks

If the SocketPermission instance is created with the Unrestricted value from PermissionState then the SocketPermission instance passes all demands. Any other value for state results in a SocketPermission instance that fails all demands unless a transport address permission is added with AddPermission.

Applies to

SocketPermission(NetworkAccess, TransportType, String, Int32)

Source:
SocketPermission.cs
Source:
SocketPermission.cs
Source:
SocketPermission.cs
Source:
SocketPermission.cs
Source:
SocketPermission.cs

Initializes a new instance of the SocketPermission class for the given transport address with the specified permission.

public:
 SocketPermission(System::Net::NetworkAccess access, System::Net::TransportType transport, System::String ^ hostName, int portNumber);
public SocketPermission(System.Net.NetworkAccess access, System.Net.TransportType transport, string hostName, int portNumber);
new System.Net.SocketPermission : System.Net.NetworkAccess * System.Net.TransportType * string * int -> System.Net.SocketPermission
Public Sub New (access As NetworkAccess, transport As TransportType, hostName As String, portNumber As Integer)

Parameters

access
NetworkAccess

One of the NetworkAccess values.

transport
TransportType

One of the TransportType values.

hostName
String

The host name for the transport address.

portNumber
Int32

The port number for the transport address.

Exceptions

hostName is null.

Remarks

This constructor creates a SocketPermission that controls access to the specified hostName and portNumber using the specified transport.

The hostName can be a DNS name, an IP address, or a specified IP subnet, such as 192.168.1.*.

The portNumber can be any valid port number defined by the transport, or SocketPermission.AllPorts.

Applies to