TcpClientOpenStreamAsync Method (Boolean, String, Int32, Flags) |
Namespace: Demo3D.Net.Protocols
public static Task<Client<IByteStreamService>> OpenStreamAsync( bool sync, string host, int port, Flags flags = default )
public async Task SendMessageAsync(string host, int port) { // Open a connection to a client. var client = await TcpClient.OpenStreamAsync(sync: false, host, port); // Send a message. var message = new byte[4]; await client.IO.Stream.WriteAsync(message, 0, message.Length); // Close the connection. client.Close(); }