What should I do? Close the socket? I can't see the problem, google doesn't help
What can cause this error? as I understand this is System type exception.
Console.WriteLine("Connection Recieved");
while (true)
{
var handler = socket.Accept();
try
{
while (handler.Connected)
{
var x = new byte[200000];
try
{
handler.Receive(x);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.InnerException);
Console.WriteLine(ex.StackTrace);
}
var command = new string(Encoding.UTF8.GetChars(x.Where(t => t != 0).ToArray()));
if (string.IsNullOrEmpty(command))
{
break;
}
var data = (Dictionary<string, object>)JsonConvert.DeserializeObject(command, (typeof(Dictionary<string, object>)));
if (data["command"].ToString() != "getLog") continue;
var response = GetStatus();
handler.Send(Encoding.UTF8.GetBytes(response));
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.InnerException);
Console.WriteLine(ex.StackTrace);
}
}