private void ClientThread(object o) { TcpClient client = (TcpClient)o; BinaryReader br = new BinaryReader(client.GetStream()); while (!_stopClients) { try { HRDMessageBlock msg = HRDMessage.BytesToHRDMessage(br); if (msg.nSize == 0) { break; } HRDTCPEventArgs e = new HRDTCPEventArgs(client, msg); if (HRDTCPEvent != null) { HRDTCPEvent(this, e); } } catch { } } _parent.SetNotifyIconText("MiniDeluxe - Running (" + --_connectionCount + " connections)"); }
void ServerHRDTCPEvent(object sender, HRDTCPEventArgs e) { String s = e.ToString().ToUpper(); BinaryWriter bw = new BinaryWriter(e.Client.GetStream()); s = s.Remove(s.IndexOf('\0')); #if DEBUG //Debug(String.Format("RX: {0}", s)); #endif if (s.Contains("GET")) { ProcessHRDTCPGetCommand(s, bw); } else if (s.Contains("SET")) { ProcessHRDTCPSetCommand(s, bw); } GC.Collect(); GC.WaitForPendingFinalizers(); }
private void ClientThread(object o) { TcpClient client = (TcpClient)o; BinaryReader br = new BinaryReader(client.GetStream()); while (!_stopClients) { try { HRDMessageBlock msg = HRDMessage.BytesToHRDMessage(br); if (msg.nSize == 0) break; HRDTCPEventArgs e = new HRDTCPEventArgs(client, msg); if (HRDTCPEvent != null) HRDTCPEvent(this, e); } catch { } } _parent.SetNotifyIconText("MiniDeluxe - Running (" + --_connectionCount + " connections)"); }
void ServerHRDTCPEvent(object sender, HRDTCPEventArgs e) { String s = e.ToString().ToUpper(); BinaryWriter bw = new BinaryWriter(e.Client.GetStream()); s = s.Remove(s.IndexOf('\0')); #if DEBUG //Debug(String.Format("RX: {0}", s)); #endif if (s.Contains("GET")) ProcessHRDTCPGetCommand(s,bw); else if(s.Contains("SET")) ProcessHRDTCPSetCommand(s,bw); GC.Collect(); GC.WaitForPendingFinalizers(); }