private void Handler() { Console.WriteLine("Client thread has started"); byte[] bytesFrom = new byte[clientSocket.ReceiveBufferSize]; NetworkStream networkStream = clientSocket.GetStream(); networkStream.Read(bytesFrom, 0, clientSocket.ReceiveBufferSize); Flux flux = Flux.DeSerialize(bytesFrom); Console.WriteLine("Recieved flux has been deserialized"); object result = executor.Execute(adapter.GenerateInstance(flux.ReadData())); Console.WriteLine("Command has been executed"); flux.WriteData(ObjectToBytes(result)); byte[] sendBytes = Flux.Serialize(flux); networkStream.Write(sendBytes, 0, sendBytes.Length); Console.WriteLine("Response has been sent"); networkStream.Flush(); clientSocket.Close(); Console.WriteLine("Socket has been closed"); }