With the following code, is there a better way to set up a UDP listen than a while(true)
with Thread.Sleep(10)
?
public void Start()
{
socket.Bind(ip);
while (true)
{
data = new byte[1024];
receivedDataLength = socket.ReceiveFrom(data, ref Remote);
raw = Encoding.ASCII.GetString(data, 0, receivedDataLength);
row = new LogRow(raw);
//Console.WriteLine(row.ClientIp);
row_queue.Enqueue(row);
Thread.Sleep(10);
}
}