private void listener() { try { // ... variables and stuff... // Enter the listening loop. while (!done) { // Perform a blocking call to accept requests. TcpClient client = tcpListener.AcceptTcpClient(); // Get a stream object for reading and writing stream = client.GetStream(); lanReader = new BinaryReader(stream); lanWriter = new BinaryWriter(stream); conversation = true; //will be set to false again after END string cache = ""; // ... (this part works) processReceivedData(); // ... } } } // after receiving data in a loop above, it's being processed by the following function: private void processReceivedData() { if (daten.Contains("<HEL.") && daten.Contains("</HEL")) { // Hello Message received sendACK(); } // ... (status, other messages, measurements...) } private bool sendACK() { if (lanWriter.BaseStream == null) //lanWriter initialized in the beginning return false; lanWriter.Write(ACK); //ACK: Acknowledgement message string return true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)