Yes, source is


//
// Weather update server in C++
// Binds PUB socket to tcp://*:5556
// Publishes random weather updates
//
// Olivier Chamoux <[email protected]>
//
#include <zmq.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define within(num) (int) ((float) num * random () / (RAND_MAX + 1.0))

int main () {

// Prepare our context and publisher
zmq::context_t context (1);
zmq::socket_t publisher (context, ZMQ_PUB);
publisher.bind("tcp://*:5556");
publisher.bind("ipc://weather.ipc");

// Initialize random number generator
srandom ((unsigned) time (NULL));
while (1) {

int zipcode, temperature, relhumidity;

// Get values that will fool the boss
zipcode = within (100000);
temperature = within (215) - 80;
relhumidity = within (50) + 10;

// Send message to all subscribers
zmq::message_t message(20);
snprintf ((char *) message.data(), 20 ,
"%05d %d %d", zipcode, temperature, relhumidity);
publisher.send(message);

}
return 0;
}
========================


Hi Graig!

Are you compiling example from ZeroMQ guide?
Ср, 24 июня 2015 г. в 4:13, Craig Anderson <[email protected] <mailto:[email protected]>>:

   I am trying to build a win32 console application
   in Visual Studio 2012.  I have a project using the example weather
   server code.
   I have installed from the 4.0.4 x86 installer.

   Here is the error?


   c:\users\craig\documents\visual studio
   2012\projects\mapd\weather_server\weather_server.cpp(10): fatal error
   C1083: Cannot open include file: 'zmq.hpp': No such file or directory



_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to