I have this error when I try to make the TcpClient asynchronous:
TcpClient' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'TcpClient' could be found (are you missing a using directive or an assembly reference?)
public async Task StartAsync(int port)
{
TcpListener tcpListener =
new TcpListener(IPAddress.Loopback,port);
while (true)
{
TcpClient tcpClient = await tcpListener.AcceptTcpClient();
ProcessClientAsync(tcpClient);
}
}
Any idea how to fix it?