private void doSend() {
            ZMsg msg;
            int remainingBuffer = BUFFER_SIZE;
            while (active && remainingBuffer-- > 0 && (msg = sender.out.poll()) != null) {
                msg.send(socket);
            }
        }