private void _subSocket_ReceiveReady(object sender, NetMQSocketEventArgs e) { bool hasMore; byte[] instrumentID = _subSocket.Receive(out hasMore); if (hasMore) { byte[] buffer = _subSocket.Receive(); var bar = MyUtils.ProtoBufDeserialize <RealTimeDataEventArgs>(buffer, new MemoryStream()); RaiseEvent(RealTimeDataReceived, null, bar); } }
public virtual CodedInputStream ReceiveData() { CodedInputStream data = null; try { Msg msg = new Msg(); msg.InitEmpty(); SubscriberSocket.Receive(ref msg); if (msg.Size > MessageTopicHeaderSize) { LastMessageSizeInBytes = msg.Size - MessageTopicHeaderSize; data = new CodedInputStream(msg.Data, MessageTopicHeaderSize, LastMessageSizeInBytes); } else { LastMessageSizeInBytes = 0; } } catch (Exception) { // ignored } return(data); }
private void ReceiveThread() { while (true) { var data = subSocket.Receive(); var mess = Encoding.UTF8.GetString(data); Console.WriteLine(mess); } }
void zmqThread() { while (app_exit == false) { if (subscriber != null) { try { Msg msg = new Msg(); msg.InitEmpty(); subscriber.Receive(ref msg); System.IO.MemoryStream ms = new System.IO.MemoryStream(msg.Data); robot_status = Serializer.Deserialize <Status>(ms); trigger(); System.Threading.Thread.Sleep(1); } catch { } } } }