SocketPermission Constructor (NetworkAccess, TransportType, String, Int32)


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

Namespace:   System.Net
Assembly:  System (in System.dll)

new : 
        access:NetworkAccess *
        transport:TransportType *
        hostName:string *
        portNumber:int -> SocketPermission


Type: System.Net.NetworkAccess

One of the NetworkAccess values.

Type: System.Net.TransportType

One of the TransportType values.

Type: System.String

The host name for the transport address.

Type: System.Int32

The port number for the transport address.

Exception Condition

hostName is null.

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.

The following example creates a SocketPermission using a NetworkAccess enumerated value, a TransportType enumerated value, the hostname, and the port number.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top