private void HandleWhisperMessage(NetMQMessage msg) { string whispertype = msg[3].ConvertToString(); if (whispertype == Endpoint.Commands.REQ_FULL_GRAPH.ToString()) { SendFullGraph(); } else if (whispertype == Endpoint.Commands.SEND_GRAPH.ToString()) { ReceivedGraph(_remoteEndpoints[new Guid(msg[1].Buffer)], msg[4].ConvertToString()); } else if (whispertype == Endpoint.Commands.PLUG_MSG.ToString()) { Log("Received remote message for local plug: " + msg.ToString()); Message remotemsg = Message.FromZyreWhisper(msg); OutputPlug outplug = RemoteEndpoints[new Guid(msg[1].Buffer)].LocateOutputPlugAtAddress(remotemsg.address); outplug.Update(remotemsg); } else if (whispertype == Endpoint.Commands.PLUG_CONNECT.ToString()) { Address inputaddress = Address.FromFullPath(msg[4].ConvertToString()); Address outputaddress = Address.FromFullPath(msg[5].ConvertToString()); Log(string.Format("Remote request to connect O->:{0} to ->I:{1}", inputaddress.ToString(), outputaddress.ToString())); OutputPlug outplug = RemoteEndpoints[new Guid(msg[1].Buffer)].LocateOutputPlugAtAddress(outputaddress); InputPlug inplug = LocateInputPlugAtAddress(inputaddress); inplug.Connect(outplug); } else { Log("Unknown whisper type received for message " + msg.ToString()); } }
public void MessageToString() { var message = new NetMQMessage(); Assert.AreEqual("NetMQMessage[<no frames>]", message.ToString()); message.Append("Hello"); Assert.AreEqual("NetMQMessage[Hello]", message.ToString()); message.AppendEmptyFrame(); message.Append("World"); Assert.AreEqual("NetMQMessage[Hello,,World]", message.ToString()); }
public string GetPupilTimestamp() { if (requestSocket != null) { requestSocket.SendFrame("t"); NetMQMessage response = new NetMQMessage(); requestSocket.TryReceiveMultipartMessage(timeout, ref response); return(response.ToString()); } return("not connected"); }