Skip to content

Instantly share code, notes, and snippets.

@hintjens
Created July 12, 2011 10:39
Show Gist options
  • Save hintjens/1077756 to your computer and use it in GitHub Desktop.
Save hintjens/1077756 to your computer and use it in GitHub Desktop.
#include <assert.h>
#include <inttypes.h>
#include "zmq.h"
int main (void)
{
void *context = zmq_init (1);
void *socket = zmq_socket (context, ZMQ_SUB);
uint64_t one = 1;
int rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &one, sizeof (uint64_t));
assert (rc == 0 || errno == ETERM);
uint64_t affinity;
size_t type_size = sizeof (uint64_t);
zmq_getsockopt (socket, ZMQ_AFFINITY, &affinity, &type_size);
assert (affinity == one);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment