Click or drag to resize

ProtocolAddressBuilder Class

A class for constructing protocol addresses.
Inheritance Hierarchy
SystemObject
  Demo3D.NetProtocolAddressBuilder

Namespace: Demo3D.Net
Assembly: Demo3D.IO (in Demo3D.IO.dll) Version: 19.00.00
Syntax
C#
public class ProtocolAddressBuilder

The ProtocolAddressBuilder type exposes the following members.

Constructors
 NameDescription
Public methodCode exampleProtocolAddressBuilder Constructs a new protocol address builder.
Public methodProtocolAddressBuilder(ProtocolAddress) Constructs a new protocol address builder with the specified URI.
Public methodProtocolAddressBuilder(String, String) Constructs a new protocol address builder with the specified scheme and host.
Public methodCode exampleProtocolAddressBuilder(String, String, Int32) Constructs a new protocol address builder with the specified scheme, host and port.
Public methodProtocolAddressBuilder(String, String, Int32, Byte) Constructs a new protocol address builder with the specified scheme, host, port, and path.
Public methodProtocolAddressBuilder(String, String, Int32, String) Constructs a new protocol address builder with the specified scheme, host, port, and path.
Top
Properties
 NameDescription
Public propertyCode exampleAddress Returns the address constructed by this builder.
Public propertyBinaryParts Gets of sets the parts of the address path as binary data.
Public propertyHost Gets or sets the host name of the address.
Public propertyParts Gets or sets the parts of the address Path.
Public propertyPort Gets or sets the port number of the address.
Public propertyScheme Gets or sets the scheme of the address.
Top
Remarks

A ProtocolAddress is a Uri pointing to a particular client or server. It allows the entire address to be represented in a single string. The string can be entered manually, or programmatically using this class.

The special hostname "any" is used to indicate any host. It's only used when a hostname is not needed but is required to create a valid URI. For example a server that accepts connections from any client running on a specified port number.

Example
The following examples show how to create a ProtocolAddress for different protocols.
C#
// Returns "tcp://host:port/".
var tcpClientAddress = new ProtocolAddressBuilder(TCP.Scheme, host, port).Address;

// Alternatively
var builder = new ProtocolAddressBuilder() {
    Scheme = TCP.Scheme,
    Host   = host,
    Port   = port
};

var tcpClientAddress2 = builder.Address;

// Returns "tcp://any:port/".
// The hostname "any" is a special hostname for servers accepting connections on all interface cards.
var tcpServerAddress = new ProtocolAddressBuilder(TCP.Scheme, null, port).Address;

// Returns "cotp://host/tsap".
var cotpClientAddress = new ProtocolAddressBuilder(COTP.Scheme, host, -1, tsap).Address;

// Construct a modbus address.
var modbusAddress = new ProtocolAddressBuilder("modbus", host, -1);
See Also