Click or drag to resize

ProtocolAddress Class

An address of a client or server.
Inheritance Hierarchy
SystemUri
  Demo3D.NetProtocolAddress

Namespace:  Demo3D.Net
Assembly:  Demo3D.IO (in Demo3D.IO.dll) Version: 18.03.00
Syntax
C#
public class ProtocolAddress : Uri

The ProtocolAddress type exposes the following members.

Constructors
  NameDescription
Public methodProtocolAddress(ProtocolAddress)
Constructs a new protocol address using the supplied address.
Public methodCode exampleProtocolAddress(String)
Constructs a new protocol address by parsing the supplied address string.
Top
Properties
  NameDescription
Public propertyBinaryParts
Decodes the absolute path of the address into segments, returning them as binary data.
Public propertyHasHost
Returns true if the hostname is set.
Public propertyNextProtocol
The next protocol indicated by the address (second part of the scheme, if present).
Public propertyParts
Decodes the absolute path of the address into parts.
Public propertyProtocol
The protocol indicated by the address (first part of the scheme).
Public propertySchemeParts
The individual parts of the scheme.
Top
Methods
  NameDescription
Public methodStatic memberToBinary
Converts 8-bit unescaped ASCII string to binary data.
Public methodStatic memberToString
Converts binary data to 8-bit unescaped ASCII string.
Top
Operators
Fields
  NameDescription
Public fieldStatic memberAnyHost
Pseudo hostname that's used to indicate a server or service running on this/any machine. For example, a server running on this machine and accepting connections from any client.
Top
Remarks

Based on Uri, a ProtocolAddress is a URI that points to a particular client or server. It includes all the information need to establish a connection without including any information about how the connection will be used.

An address should explicitly contain any information required to connect, but exclude any connection parameters, routing information, etc, unless required to identify the peer.

AddressDescription
tcp://host:1234Where 1234 is the port number.
modbus://host:1234
cotp://host/tsapWhere "tsap" is the ISO TSAP.

A server address would normally exclude the hostname. You would include a hostname if you wanted the server to run only on a specific network interface. Also (since a URI cannot contain a port number unless it also contains a hostname) you would use the special hostname ProtocolAddress.AnyHost ("any").

AddressDescription
tcp://localhost:1234A server accepting connections only on localhost.
cotp://any:1234/tsapA server accepting COTP connections for "tsap" on port 1234 (instead of the default port 102).

Since protocols are stacked on top of other protocols, it can also be useful to include the full protocol path in the URI scheme. For example, Modbus is a protocol that typically uses TCP, but it's also quite common to use the Modbus protocol over UDP. And another example, Fetch/Write can run over TCP or over ISO COTP.

AddressDescription
modbus://host:1234Defaults to TCP.
modbus.tcp://host:1234Explicitly require Modbus over TCP.
modbus.udp://host:1234Explicitly require Modbus over UDP.
fetchwrite://host:1234Defaults to TCP.
fetchwrite.cotp://host/tsapExplicitly require COTP, and provide a TSAP instead of a port number.

Best practice for creating a ProtocolAddress is to use the ProtocolAddressBuilder class, and to use the built-in constants for scheme names (eg Scheme).

See Also