public ZMsg Request(string service, string token, ZMsg msg, int timeout = 2500) { IntPtr c_msg = C.zmsg_new(); IEnumerator <byte[]> fe = msg.GetEnumerator(); while (fe.MoveNext()) { IntPtr c_frame = ZMsg.ToZFramePtr(fe.Current); C.zmsg_push_back(c_msg, c_frame); } IntPtr res = C.zbuscli_request(this.connection.Handle, service, token, c_msg, timeout); if (res == IntPtr.Zero) { throw new ZBusException("request timeout"); } ZMsg result = null; if (res != IntPtr.Zero) { result = ZMsg.ToZMsg(res); } return(result); }
public ZMsg Send(AsynCtrl ctrl, ZMsg msg) { IntPtr c_msg = C.zmsg_new(); IEnumerator <byte[]> fe = msg.GetEnumerator(); while (fe.MoveNext()) { IntPtr c_frame = ZMsg.ToZFramePtr(fe.Current); C.zmsg_push_back(c_msg, c_frame); } IntPtr c_ctrl = C.asyn_ctrl_new(ctrl.Service, ctrl.Token, ctrl.Timeout, ctrl.PeerId, ctrl.MessageId); IntPtr res = C.zbuscli_send(this.connection.Handle, c_ctrl, c_msg); C.asyn_ctrl_destroy(out c_ctrl); if (res == IntPtr.Zero) { throw new ZBusException("send timeout"); } ZMsg result = null; if (res != IntPtr.Zero) { result = ZMsg.ToZMsg(res); } return(result); }
public ZMsg Recv(int timeout) { IntPtr res = C.zbusconn_recv(this._handle, timeout); ZMsg result = null; if (res != IntPtr.Zero) { result = ZMsg.ToZMsg(res); } return(result); }
public ZMsg Recv(int pingInterval) { IntPtr res = C.zbuscli_recv(this.connection.Handle, pingInterval); ZMsg result = null; if (res != IntPtr.Zero) { result = ZMsg.ToZMsg(res); } return(result); }
public ZMsg Recv() { IntPtr res = C.zbuswrk_recv(this.connection.Handle, this._handle); IntPtr c_sock_id, c_msg_id; C.zbuswrk_get_address(this._handle, out c_sock_id, out c_msg_id); this.RecvSockId = ZMsg.ToZFrame(c_sock_id); this.RecvMsgId = ZMsg.ToZFrame(c_msg_id); ZMsg result = null; if (res != IntPtr.Zero) { result = ZMsg.ToZMsg(res); } return(result); }