Exemplo n.º 1
0
    // Client thread which does not block Update()
    void NetMQClient()
    {
        AsyncIO.ForceDotNet.Force();
        NetMQConfig.ManualTerminationTakeOver();
        NetMQConfig.ContextCreate(true);

        //string msg;
        var timeout = new System.TimeSpan(0, 0, 1); //1sec

        Debug.Log("Connect to the server.");

        pairSocket = new NetMQ.Sockets.PairSocket();
        pairSocket.Options.ReceiveHighWatermark = 0;
        //pairSocket.Connect("tcp://192.168.1.122:55555");
        pairSocket.Connect("tcp://192.168.1.111:55555");

        is_connected = true;

        while (is_connected && stop_thread_ == false)
        {
            is_connected = pairSocket.TryReceiveFrameString(timeout, out msg);
            pairSocket.TrySendFrame(timeout, final);
        }

        pairSocket.Close();
        Debug.Log("ContextTerminate.");
        NetMQConfig.ContextTerminate();
        NetMQConfig.Cleanup();
    }
Exemplo n.º 2
0
    private void SendMessageToRamulator(string message)
    {
        bool wouldNotHaveBlocked = zmqSocket.TrySendFrame(message, more: false);

        Debug.Log("Tried to send a message: " + message + " \nWouldNotHaveBlocked: " + wouldNotHaveBlocked.ToString());
        ReportMessage(message, true);
    }