C++\C# clients recieve updates, if client and server are written in the same language. So both servers C++\C# sends notification. The issue is happen if only C# client tries to get updates from C++ server.
On 20 August 2012 17:32, Bennie Kloosteman <[email protected]> wrote: > Is it not getting the notifcation or is teh server just not sending the > messages out ? > > If its not getting the notification i have no idea - maybe put a break point > and confirm its not getting it (then its in the tcp/ip stack) > > If it is getting it but not sending out the matches it maybe because the > subscription is not matched eg > > zipcode is ASCII vs zip code in unicode. > > Ben > > On Mon, Aug 20, 2012 at 8:15 PM, Alexander Voron <[email protected]> > wrote: >> >> Both client and server are built and run without any errors. The error >> is the server didn't recieve messages. >> >> On 20 August 2012 16:10, Bennie Kloosteman <[email protected]> wrote: >> > What error...is it a unicode error since your not using wchar eg no >> > match ? >> > >> > Ben >> > >> > On Mon, Aug 20, 2012 at 3:55 PM, Alexander Voron >> > <[email protected]> >> > wrote: >> >> >> >> I've tried to program sending messages from one server to multiple >> >> clients. I have to use C# on client side, C++ on server side. I took >> >> example from http://zguide.zeromq.org/page:all#toc8 for server: >> >> >> >> #define within(num) (int) ((float) num * rand () / (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 >> >> srand ((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; >> >> } >> >> >> >> And for client: >> >> >> >> namespace ZMQGuide >> >> { >> >> internal class Program >> >> { >> >> public static void Main(string[] args) { >> >> Console.WriteLine("Collecting updates from weather server…"); >> >> >> >> // default zipcode is 10001 >> >> string zipcode = "10001 "; // the reason for having a space >> >> after 10001 is in case of the message would start with 100012 which we >> >> are not interested in >> >> >> >> if (args.Length > 0) >> >> zipcode = args[1] + " "; >> >> >> >> using (var context = new Context(1)) >> >> { >> >> using (Socket subscriber = context.Socket(SocketType.SUB)) >> >> { >> >> subscriber.Subscribe(zipcode, Encoding.Unicode); >> >> subscriber.Connect("tcp://localhost:5556"); >> >> >> >> const int updatesToCollect = 100; >> >> int totalTemperature = 0; >> >> >> >> for (int updateNumber = 0; updateNumber < >> >> updatesToCollect; updateNumber++) >> >> { >> >> string update = subscriber.Recv(Encoding.Unicode); >> >> totalTemperature += >> >> Convert.ToInt32(update.Split()[1]); >> >> } >> >> >> >> Console.WriteLine("Average temperature for zipcode {0} >> >> was {1}F", zipcode, totalTemperature / updatesToCollect); >> >> } >> >> } >> >> } >> >> } >> >> } >> >> >> >> They don't communicate with each other. On the client side (C++) I >> >> commented line with ipc interaction because on Windows client with ipc >> >> is failed. C# - C#, C++ - C++ interactions works correctly in this >> >> case. I use 0MQ 2.2, clrzmq 2.2.5. >> >> _______________________________________________ >> >> zeromq-dev mailing list >> >> [email protected] >> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> > >> > >> > >> > _______________________________________________ >> > zeromq-dev mailing list >> > [email protected] >> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> > >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
