public TargetFeatureMsg Comparison(TargetFeatureMsg msg) { TargetFeatureMsg msg_reply = new TargetFeatureMsg(); ZMessage zMsg = new ZMessage(); zMsg.Add(new ZFrame(msg.ToByteArray())); socket.Send(zMsg); using (ZFrame reply = socket.ReceiveFrame()) { //Console.WriteLine(" Received: {0} {1}!", requestText, reply.ReadString()); msg_reply.MergeFrom(reply.Read()); Console.WriteLine("" + msg_reply.ImageBase64); if (ShowOBJInfo != null) { try { ShowOBJInfo(msg_reply); } catch (Exception ex) { Console.WriteLine(ex.Message); } } return(msg_reply); } return(null); }
public TargetFeatureMsg Detection(TargetFeatureMsg msg) { try { TargetFeatureMsg msg_reply = new TargetFeatureMsg(); ZMessage zMsg = new ZMessage(); zMsg.Add(new ZFrame(msg.ToByteArray())); socket.Send(zMsg); using (ZFrame reply = socket.ReceiveFrame()) { //Console.WriteLine(" Received: {0} {1}!", requestText, reply.ReadString()); msg_reply.MergeFrom(reply.Read()); Console.WriteLine("" + msg_reply.ImageBase64); return(msg_reply); } }catch (Exception ex) { //LogHelper.WriteLog(typeof(ZmqDetection), ex.Message); } return(null); }
private void ReceiveMsg() { ZError errors; Console.WriteLine("ZmqComparison Thread Start Receive Message!"); while (receiving) { using (ZFrame frame = receiver.ReceiveFrame(ZSocketFlags.DontWait, out errors)) { if (null != frame) { // Process task TargetFeatureMsg msg_receive = new TargetFeatureMsg(); msg_receive.MergeFrom(frame.Read()); //Console.WriteLine("" + msg_receive.Processed); if (ShowOBJInfo != null) { try { ShowOBJInfo(msg_receive); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { if (errors == ZError.ETERM) { return; // Interrupted } if (errors != ZError.EAGAIN) { throw new ZException(errors); } } } Thread.Sleep(10); } Console.WriteLine("ZmqComparison Thread End Receive Message!"); }