hi,
I am building a multi platform library using zeromq. So far,
everything went well while running on Linux. However, on Mac OS I am
not able to make zbeacon work. Attached you can find a test example
that works on Linux but not on Mac.
The program, just creates a beacon, subscribes to everything and
publishes a beacon. After that, I am expecting to receive the beacon
when I do zstr_recv(...).
In Mac OS, I don't receive any data. I'm using Mac OS X 10.9.3
(Mavericks) and czmq v2.2.0.
Is zbeacon suppose to work on Mac OS?
Thanks,
Carlos
cmake_minimum_required (VERSION 2.8)
project (beaconTest)
include (FindPkgConfig)
#################################################
# Find czmq.:
pkg_check_modules(czmq libczmq>=2.1.0)
if (NOT czmq_FOUND)
message (STATUS "Looking for czmq pkgconfig file - not found")
BUILD_ERROR ("czmq not found, Please install czmq")
else ()
message (STATUS "Looking for czmq pkgconfig file - found")
include_directories(${czmq_INCLUDE_DIRS})
link_directories(${czmq_LIBRARY_DIRS})
endif ()
#indicate the entry point for the executable
add_executable (beaconTest beaconTest.cc)
# Indicate which libraries to include during the link process.
target_link_libraries (beaconTest czmq)#include <czmq.h>
#include <iostream>
#include <string>
//////////////////////////////////////////////////
int main(int argc, char **argv)
{
zctx_t *ctx = zctx_new();
zbeacon_t *beacon = zbeacon_new(ctx, 11312);
zbeacon_subscribe(beacon, NULL, 0);
zbeacon_publish(beacon, (byte *) "A message", 9);
char *srcAddr = zstr_recv(zbeacon_socket(beacon));
zframe_t *frame = zframe_recv(zbeacon_socket(beacon));
byte *data = zframe_data(frame);
char *msg = reinterpret_cast<char*>(&data[0]);
std::string recvMsg = std::string(msg);
std::cout << "Received beacon from " << srcAddr << std::endl;
if (recvMsg == "A message")
std::cout << "Test passed" << std::endl;
else
std::cout << "Not passed. Content: [" << recvMsg << "]" << std::endl;
zbeacon_destroy(&beacon);
}
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev