I need to check if my client has something in the buffer so I did not wait to write it.
private async void ThreadMethod_ListenClient()
{
while (true) {
if (ClientQueue.Count == 0)
continue;
Client client = (Client)ClientQueue.Dequeue ();
if (client.Reader != null) {
string Say = await client.Reader.ReadLineAsync();
if (Say != null) {
if (Say.Length != 0) {
Console.WriteLine (Say);
}
}
}
ClientQueue.Enqueue (client);
}
}
client.Reader : StreamReader from TcpClient
client.Socket : TcpClient
How to check if 'client.Reader' empty?
obs. C# with Mono