Click or drag to resize

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

Open an ISO COTP connection.

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

Parameters

sync  Boolean
If true, the Task returned is guaranteed to be complete.
host  String
The host to connect to.
tsap  Byte
The destination TSAP.
flags  Flags  (Optional)
Connection flags.
port  Int32  (Optional)
ISO port number.

Return Value

TaskClientIPacketIOService
A new COTP client.
Example
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