Click or drag to resize

ProtocolAddressBuilder Class

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

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

The ProtocolAddressBuilder type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleProtocolAddressBuilder
Constructs a new protocol address builder.
Public methodCode exampleProtocolAddressBuilder(String)
Contructs a new protocol address builder with the specified string address.
Public methodProtocolAddressBuilder(Uri)
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 methodCode exampleProtocolAddressBuilder(String, String, Int32, String)
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 propertyBinarySegments
Gets of sets the segments of the address path as binary data.
Public propertySegments
Gets or sets the segments of the address Path.
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.

Examples
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();

builder.Scheme = TCP.Scheme;
builder.Host   = host;
builder.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 an address from a string template, and then set the port number.
var modbusAddress = new ProtocolAddressBuilder("modbus://host") {
    Port = 1234
};
See Also