Good day.
To wait for incoming connections I use the TcpListener class. What should I do if I have a timeout to wait for a new connection = 30 seconds, and the installation of Server.ReceiveTimeout does not work?
Code:
SMTP_Listener = new TcpListener(IPAddress.Any, 8888); SMTP_Listener.Server.ReceiveTimeout = timeout; // не срабатывает SMTP_Listener.Start(); SMTP_Listener.Server.ReceiveTimeout = 5; while (true) { Socket clientSocket = SMTP_Listener.AcceptSocket(); // висим на этой строчке и все, никуда дальше. Как таймаут сделать? if (clientSocket.Connected) { } Console.WriteLine("***"); } thank