protected override void Run() { ForceDotNet.Force(); client = new StreamSocket(); //client.Options.RouterRawSocket = true; client.Bind("tcp://localhost:5555"); Debug.Log("Communication started"); long timeSinceLastMessage = 0; while (true) { List <byte[]> message = null; bool receivedmessage = false; receivedmessage = client.TryReceiveMultipartBytes(ref message, 2); if (receivedmessage) { timeSinceLastMessage = 0; Debug.Log("Message Received"); Char[] charconvert = System.Text.Encoding.UTF8.GetChars(message[1], 0, message[1].Length); if (string.Join("", charconvert) == "PointData Finished" || System.Text.Encoding.UTF8.GetString(message[1], 0, message[1].Length) == "PointData Finished") { Debug.Log("Transfer finished"); break; } Debug.Log("Recieved bytes " + string.Join("", message[1])); float convert = BitConverter.ToSingle(message[1], 0); Debug.Log("Recieved : " + convert); Array.Reverse(message[1]); float convert2 = BitConverter.ToSingle(message[1], 0); Debug.Log("Reversed : " + convert2); } //Char[] convert2 = System.Text.Encoding.ASCII.GetChars(message, 0, message.Length); //Debug.Log("Recieved : " + string.Join("",convert2)); timeSinceLastMessage++; if (timeSinceLastMessage > timeLimit) { Debug.Log("Timeout"); break; } } client.Disconnect("tcp://localhost:5555"); Debug.Log("Stopping Connection"); client.Dispose(); NetMQConfig.Cleanup(); isRunning = false; }