Click or drag to resize

ProtocolAddressBuilder Constructor (String, String, Int32, String)

Constructs a new protocol address builder with the specified scheme, host, port, and path.

Namespace:  Demo3D.Net
Assembly:  Demo3D.IO (in Demo3D.IO.dll) Version: 10.0.0.0 (10.0.0.0)
Syntax
C#
public ProtocolAddressBuilder(
	string scheme,
	string host,
	int port,
	string path
)

Parameters

scheme
Type: SystemString
The protocol scheme (eg "tcp").
host
Type: SystemString
The hostname (or null for a server).
port
Type: SystemInt32
The port (or -1 for a protocol that doesn't support ports).
path
Type: SystemString
Additional connection path.
Examples
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