Click or drag to resize

CotpClientOpenAsync Method (String, Byte, Boolean)

Open an ISO COTP connection.

Namespace:  Demo3D.Net.Protocols
Assembly:  Demo3D.IO (in Demo3D.IO.dll) Version: 10.0.0.0 (10.0.0.0)
Syntax
C#
public static Task<Client<IPacketIOService>> OpenAsync(
	string host,
	byte[] tsap,
	bool openConnection = true
)

Parameters

host
Type: SystemString
The host to connect to.
tsap
Type: SystemByte
The destination TSAP.
openConnection (Optional)
Type: SystemBoolean
False to return the socket without opening the connection.

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(host, tsap);

    // Send a message.
    using (var packet = client.IO.Write()) {
        packet.WriteString("hello");  // The message is the string "hello".
        packet.Flush();               // Send the message.
    }

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