I'm a zeromq newb and have implemented the REQ/RES Lazy Pirate pattern with C#. It's essentially a port from the C example given in the documentation. It's harnessed by tests, and seems to be work to my expectations. I'm interested to know if I'm understanding the pattern correctly, or if I can improve the API. If anyone knows of a pre-existing solution, I'd love to know too. Any advice would be great. using System;using System.Text;using ZMQ;namespace zeromq.net {    public class LazyPirateClient : ReqRes {        private readonly string _address;        private readonly long _timeOut;        private readonly int _retries;        private bool _responseReceived;        private int _attempt;        public LazyPirateClient(string address, long timeOut, int retries) {            _address = address;            _timeOut = timeOut;            _retries = retries;                    }                                          public override void Send(Func<byte[]> byteProvider) {            _responseReceived = false;            using (var context = new Context(1)) {                _attempt = 0;                do {                    using (var requester = context.Socket(SocketType.REQ)) {                        _attempt++;                        requester.Connect(_address);                        requester.Send(byteProvider(), SendRecvOpt.NOBLOCK);                        var item = requester.CreatePollItem(IOMultiPlex.POLLIN);                        item.PollInHandler += item_PollInHandler;                        context.Poll(new[] { item }, _timeOut);                        requester.Linger = 0;                    }                } while (_attempt < _retries && !_responseReceived);                if (!_responseReceived)                     throw new PermenantFailException(_attempt);            }        }        private void item_PollInHandler(Socket socket, IOMultiPlex revents) {            _responseReceived = true;            var bytes = socket.Recv(SendRecvOpt.NOBLOCK);            OnReceived(new ResponseReceivedEventArgs(bytes, _attempt));        }                    }     public abstract class ReqRes {        public abstract void Send(Func<byte[]> byteProvider);        public delegate void ResponseReceived(object sender, ResponseReceivedEventArgs e);        public event ResponseReceived ReceivedHandler;        public void OnReceived(ResponseReceivedEventArgs e) {            var handler = ReceivedHandler;            if (handler != null) handler(this, e);        }     }
Lazy Pirate Request Response pattern using zeromq and C#/.NET bindings
c#;zeromq