zeromq helper functions to reduce code duplication