EchoTool
EchoTool copied to clipboard
CPU Spike to 100%
I just tried running your tool with 1KB of data with unlimited number of messages, and it seems the CPU is spiking at 100% while the client server is communicating.
Client: echotool 127.0.0.1 /p tcp /r 5757 /n 0 /d ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef
Server: echotool /p tcp /s 5757
This appears to be an issue with busy waiting in the TcpEchoServer.ServerThread. A quick and dirty fix for me was to add a sleep into the loop (note that this will affect the timeout logic):
while (tcpClient.Client.Connected && serverRunning && !timeOut)
{
TimeSpan timeoutSpan = DateTime.Now - tcpState.TimeoutWatch;
if (timeoutSpan.Seconds >= ConnectionTimeout)
timeOut = true;
Thread.Sleep(100);
}
CurlingGeek is right. The problem is that the Thread get the whole cycle busy.
I'll fix it.
echotool server.to-test.com /p udp /r 4578 /d Hello
I revceived the message bellow.
This is usually a temporary error during hostname resolution and means that the local server has not received a response from an authorized server.
Este geralmente é um erro temporário durante a resolução do nome do host e significa que o servidor local não recebeu uma resposta de um servidor autorizado
Statistics: Received=0, Corupted=0, Lost=0