AForge.Robotics.Surveyor.SRV1.DiscardIncomingData C# (CSharp) Method

DiscardIncomingData() private method

private DiscardIncomingData ( Socket socket, ManualResetEvent stopEvent ) : void
socket Socket
stopEvent System.Threading.ManualResetEvent
return void
        private void DiscardIncomingData( Socket socket, ManualResetEvent stopEvent  )
        {
            byte[] buffer = new byte[100];

            while ( !stopEvent.WaitOne( 0, false ) )
            {
                int read = socket.Receive( buffer, 0, 100, SocketFlags.None );

                if ( socket.Available == 0 )
                {
                    // System.Diagnostics.Debug.WriteLine( "<< (" + read + ") " +
                    //     System.Text.ASCIIEncoding.ASCII.GetString( buffer, 0, Math.Min( 100, read ) ) );

                    break;
                }
            }
        }
    }