Class NetworkManager
Abstract manager class for network operations.
Inherited Members
Namespace: Dicom.Network
Assembly: cs.temp.dll.dll
Syntax
public abstract class NetworkManager
Fields
IPv4Any
String representation of the "Any" IPv4 address, i.e. specifying the listener to listen to all applicable IPv4 addresses.
Declaration
public const string IPv4Any = "0.0.0.0"
Field Value
Type | Description |
---|---|
String |
IPv4Loopback
String representation of the "Loopback" IPv4 address, i.e. specifying the listener to listen to the local IPv4 host.
Declaration
public const string IPv4Loopback = "127.0.0.1"
Field Value
Type | Description |
---|---|
String |
IPv6Any
String representation of the "Any" IPv6 address, i.e. specifying the listener to listen to all applicable IPv6 addresses.
Declaration
public const string IPv6Any = "::"
Field Value
Type | Description |
---|---|
String |
IPv6Loopback
String representation of the "Loopback" IPv6 address, i.e. specifying the listener to listen to the local IPv6 host.
Declaration
public const string IPv6Loopback = "::1"
Field Value
Type | Description |
---|---|
String |
Properties
MachineName
Gets machine name.
Declaration
public static string MachineName { get; }
Property Value
Type | Description |
---|---|
String |
MachineNameImpl
Implementation of the machine name getter.
Declaration
protected abstract string MachineNameImpl { get; }
Property Value
Type | Description |
---|---|
String |
Methods
CreateNetworkListener(Int32)
Create a network listener object, listening to all IPv4 addressess.
Declaration
[Obsolete("Use the CreateNetworkListener(string, int) overload with IPv4Any in string argument.")]
public static INetworkListener CreateNetworkListener(int port)
Parameters
Type | Name | Description |
---|---|---|
Int32 | port | Network port to listen to. |
Returns
Type | Description |
---|---|
INetworkListener | Network listener implementation. |
CreateNetworkListener(String, Int32)
Create a network listener object.
Declaration
public static INetworkListener CreateNetworkListener(string ipAddress, int port)
Parameters
Type | Name | Description |
---|---|---|
String | ipAddress | IP address(es) to listen to. |
Int32 | port | Network port to listen to. |
Returns
Type | Description |
---|---|
INetworkListener | Network listener implementation. |
CreateNetworkListenerImpl(String, Int32)
Platform-specific implementation to create a network listener object.
Declaration
protected abstract INetworkListener CreateNetworkListenerImpl(string ipAddress, int port)
Parameters
Type | Name | Description |
---|---|---|
String | ipAddress | IP address(es) to listen to. |
Int32 | port | Network port to listen to. |
Returns
Type | Description |
---|---|
INetworkListener | Network listener implementation. |
CreateNetworkStream(String, Int32, Boolean, Boolean, Boolean, Int32)
Create a network stream object.
Declaration
public static INetworkStream CreateNetworkStream(string host, int port, bool useTls, bool noDelay, bool ignoreSslPolicyErrors, int millisecondsTimeout = 5000)
Parameters
Type | Name | Description |
---|---|---|
String | host | Network host. |
Int32 | port | Network port. |
Boolean | useTls | Use TLS layer? |
Boolean | noDelay | No delay? |
Boolean | ignoreSslPolicyErrors | Ignore SSL policy errors? |
Int32 | millisecondsTimeout | a timeout in milliseconds for creating a network stream |
Returns
Type | Description |
---|---|
INetworkStream | Network stream implementation. |
CreateNetworkStreamImpl(String, Int32, Boolean, Boolean, Boolean, Int32)
Platform-specific implementation to create a network stream object.
Declaration
protected abstract INetworkStream CreateNetworkStreamImpl(string host, int port, bool useTls, bool noDelay, bool ignoreSslPolicyErrors, int millisecondsTimeout)
Parameters
Type | Name | Description |
---|---|---|
String | host | Network host. |
Int32 | port | Network port. |
Boolean | useTls | Use TLS layer? |
Boolean | noDelay | No delay? |
Boolean | ignoreSslPolicyErrors | Ignore SSL policy errors? |
Int32 | millisecondsTimeout | The timeout in milliseconds for creating a network stream |
Returns
Type | Description |
---|---|
INetworkStream | Network stream implementation. |
IsSocketException(Exception, out Int32, out String)
Checks whether specified exception
represents a socket exception.
Declaration
public static bool IsSocketException(Exception exception, out int errorCode, out string errorDescriptor)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Exception to validate. |
Int32 | errorCode | Error code, valid if |
String | errorDescriptor | Error descriptor, valid if |
Returns
Type | Description |
---|---|
Boolean | True if |
IsSocketExceptionImpl(Exception, out Int32, out String)
Platform-specific implementation to check whether specified exception
represents a socket exception.
Declaration
protected abstract bool IsSocketExceptionImpl(Exception exception, out int errorCode, out string errorDescriptor)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Exception to validate. |
Int32 | errorCode | Error code, valid if |
String | errorDescriptor | Error descriptor, valid if |
Returns
Type | Description |
---|---|
Boolean | True if |
SetImplementation(NetworkManager)
Sets the network manager implementation to use.
Declaration
public static void SetImplementation(NetworkManager impl)
Parameters
Type | Name | Description |
---|---|---|
NetworkManager | impl | Network manager implementation. |
TryGetNetworkIdentifier(out DicomUID)
Attempt to obtain a unique network identifier, e.g. based on a MAC address.
Declaration
public static bool TryGetNetworkIdentifier(out DicomUID identifier)
Parameters
Type | Name | Description |
---|---|---|
DicomUID | identifier | Unique network identifier, if found. |
Returns
Type | Description |
---|---|
Boolean | True if network identifier could be obtained, false otherwise. |
TryGetNetworkIdentifierImpl(out DicomUID)
Platform-specific implementation to attempt to obtain a unique network identifier, e.g. based on a MAC address.
Declaration
protected abstract bool TryGetNetworkIdentifierImpl(out DicomUID identifier)
Parameters
Type | Name | Description |
---|---|---|
DicomUID | identifier | Unique network identifier, if found. |
Returns
Type | Description |
---|---|
Boolean | True if network identifier could be obtained, false otherwise. |
Use(NetworkManager)
Instead of statically 'setting' the network manager (which changes the behavior for everything in the same AppDomain) it is also possible to use a scoped network manager which only impacts consumers with a reference to this scoped network manager.
Declaration
public static ScopedNetworkManager Use(NetworkManager implementation)
Parameters
Type | Name | Description |
---|---|---|
NetworkManager | implementation |
Returns
Type | Description |
---|---|
ScopedNetworkManager |