Click or drag to resize

CotpClientOpenAsync Method (Boolean, String, Byte, Flags, Int32)

Open an ISO COTP connection.

Namespace:  Demo3D.Net.Protocols
Assembly:  Demo3D.IO (in Demo3D.IO.dll) Version: 15.0.2.11458
Syntax
C#
public static Task<Client<IPacketIOService>> OpenAsync(
	bool sync,
	string host,
	byte[] tsap,
	Flags flags = default,
	int port = -1
)

Parameters

sync
Type: SystemBoolean
If true, the Task returned is guaranteed to be complete.
host
Type: SystemString
The host to connect to.
tsap
Type: SystemByte
The destination TSAP.
flags (Optional)
Type: Demo3D.NetFlags
Connection flags.
port (Optional)
Type: SystemInt32
ISO port number.

Return Value

Type: TaskClientIPacketIOService
A new COTP client.
Examples
C#
public async Task SendMessageAsync(string host, string tsap) {
    // Open a connection to a client.
    var client = await CotpClient.OpenAsync(sync: false, host, tsap);

    // Send a message.
    var message = BinaryTextEncoding.NullTerminatedASCII.GetBytes("hello");
    await client.IO.WriteAsync(message);

    // Close the connection.
    client.Close();
}
See Also