private static void _hotelListener_DataArrival(TcpSocket client, long available) { var trame = string.Empty; //string s = ""; do { if (available == 0) { continue; } var c = Convert.ToInt32(client.GetData(1).GetValue(0)); switch (c) { case 2: { trame = ((char)c).ToString(); break; } case 3: { trame += ((char)c).ToString(); try { if (client.GetData().Length > 0) { c = (int)client.GetData(1).GetValue(0); trame += ((char)c).ToString(); } } catch { c = 0; } break; } case 5: case 6: { trame = ((char)c).ToString(); break; } default: { trame += ((char)c).ToString(); break; } } } while (client.BytesAvailable != 0); //Console.WriteLine($"Received from minibar client: {trame}"); var logMessage = (trame.Length == 1 & trame.Equals("6")) ? "<Ask>" : $"<STX>{trame.Trim(new char[] { STX, ETX })}<ETX>"; Logger.Info($"Received from minibar client: {logMessage}"); Recoimessagefiastcp(trame); }