C# Class GSF.Communication.Transport

Defines helper methods related to IP socket based communications.
Show file Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Methods

Method Description
CreateEndPoint ( string hostNameOrAddress, int port, IPStack stack ) : IPEndPoint

Creates an IPEndPoint for the specified host name and port number.

CreateSocket ( string address, int port, ProtocolType protocol, IPStack stack, bool allowDualStackSocket = true ) : Socket

Creates a Socket for the specified port and protocol.

GetDefaultIPStack ( ) : IPStack

Gets the default IP stack for this system.

GetInterfaceIPStack ( string>.Dictionary connectionStringEntries ) : IPStack

Derives the desired IPStack from the "interface" setting in the connection string key/value pairs.

The "interface" setting will be added to the connectionStringEntries if it doesn't exist, in this case return value will be IPStack.Default.

IsDestinationReachable ( IPEndPoint targetIPEndPoint ) : bool

Determines if the specified UDP destination is listening for data.

IsIPv6IP ( string ipAddress ) : bool

Determines if the specified ipAddress is an IPv6 IP.

IsLocalAddress ( string hostNameOrAddress ) : bool

Determines if an IP address (or DNS name) is a local IP address.

IsMulticastIP ( IPAddress ipAddress ) : bool

Determines if the specified ipAddress is a multicast IP.

IsPortNumberValid ( string port ) : bool

Determines whether the specified port is valid.

Method Details

CreateEndPoint() public static method

Creates an IPEndPoint for the specified host name and port number.
public static CreateEndPoint ( string hostNameOrAddress, int port, IPStack stack ) : IPEndPoint
hostNameOrAddress string The host name or IP address to resolve.
port int The port number to be associated with the address.
stack IPStack Desired IP stack to use.
return System.Net.IPEndPoint

CreateSocket() public static method

Creates a Socket for the specified port and protocol.
public static CreateSocket ( string address, int port, ProtocolType protocol, IPStack stack, bool allowDualStackSocket = true ) : Socket
address string The local address where the will be bound.
port int The port number at which the will be bound.
protocol ProtocolType One of the values.
stack IPStack Desired IP stack to use.
allowDualStackSocket bool Determines if dual-mode socket is allowed when endpoint address is IPv6.
return Socket

GetDefaultIPStack() public static method

Gets the default IP stack for this system.
public static GetDefaultIPStack ( ) : IPStack
return IPStack

GetInterfaceIPStack() public static method

Derives the desired IPStack from the "interface" setting in the connection string key/value pairs.
The "interface" setting will be added to the connectionStringEntries if it doesn't exist, in this case return value will be IPStack.Default.
public static GetInterfaceIPStack ( string>.Dictionary connectionStringEntries ) : IPStack
connectionStringEntries string>.Dictionary Connection string key/value pairs.
return IPStack

IsDestinationReachable() public static method

Determines if the specified UDP destination is listening for data.
public static IsDestinationReachable ( IPEndPoint targetIPEndPoint ) : bool
targetIPEndPoint System.Net.IPEndPoint The for the UDP destination to be checked.
return bool

IsIPv6IP() public static method

Determines if the specified ipAddress is an IPv6 IP.
public static IsIPv6IP ( string ipAddress ) : bool
ipAddress string IP address to check.
return bool

IsLocalAddress() public static method

Determines if an IP address (or DNS name) is a local IP address.
An error is encountered when resolving . is an invalid IP address. The length of is greater than 255 characters. is null.
public static IsLocalAddress ( string hostNameOrAddress ) : bool
hostNameOrAddress string DNS name or IP address to test.
return bool

IsMulticastIP() public static method

Determines if the specified ipAddress is a multicast IP.
public static IsMulticastIP ( IPAddress ipAddress ) : bool
ipAddress System.Net.IPAddress IP address to check.
return bool

IsPortNumberValid() public static method

Determines whether the specified port is valid.
public static IsPortNumberValid ( string port ) : bool
port string The port number to be validated.
return bool