ExtensionMethods.RequestAsync Method (Tcp.TcpClient, Byte[], Int32)

Tungsten Suite

ExtensionMethodsRequestAsync Method (TcpTcpClient, Byte, Int32)

Sends a request to the server and waits for a response. Can be used along with, or in lieu of, the regular method of calling Write and handling the BytesReceived event.

Namespace:  W.Net
Assembly:  Tungsten.Net (in Tungsten.Net.dll) Version: 2.0.2
public static Task<byte[]> RequestAsync(
	this TcpTcpClient client,
	byte[] request,
	int msTimeout


Type: W.NetTcpTcpClient
The W.Net.Tcp.TcpClient instance
Type: SystemByte
The request to be made to the server
Type: SystemInt32
The time to wait for a response

Return Value

Type: TaskByte
Null if a timeout occurs, otherwise the server's response

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type TcpTcpClient. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also