[zeromq-dev] C#Client
Daniele Teti
d.teti at bittime.it
Fri Jul 17 15:59:47 CEST 2009
excuse me... "doesn't work" meens that program "hang" on follow line
" zmq.Receive(out pippo, out theType, true);"
why this blocker "receive" doesn't find the message?
Daniele Teti wrote:
> I'm still research a way to use ZeroMQ in Delphi.
>
> But I want to check my installation and my ZeroMQ knowledge, so I
> wrote a simple test program in C#.
> But... doesn't work!
>
> Please, can somewone check my code?
> (zmq_server.exe is runing without parameters)
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
>
> namespace ConsoleApplication1
> {
> class Program
> {
> public static byte[] StrToByteArray(string str)
> {
> System.Text.ASCIIEncoding encoding = new
> System.Text.ASCIIEncoding();
> return encoding.GetBytes(str);
> }
> static void Main(string[] args)
> {
>
> Zmq zmq = new Zmq("127.0.0.1");
> int ex = zmq.CreateExchange("daniele", Zmq.SCOPE_LOCAL,
> "", Zmq.STYLE_DATA_DISTRIBUTION);
> int q = zmq.CreateQueue("paperino", Zmq.SCOPE_LOCAL, "",
> Zmq.NO_LIMIT, Zmq.NO_LIMIT, Zmq.NO_LIMIT);
> zmq.Bind("daniele", "paperino", "", "");
> zmq.Send(ex, StrToByteArray("daniele"), true);
> zmq = null;
>
> zmq = new Zmq("127.0.0.1");
> ex = zmq.CreateExchange("daniele", Zmq.SCOPE_LOCAL, "",
> Zmq.STYLE_DATA_DISTRIBUTION);
> q = zmq.CreateQueue("paperino", Zmq.SCOPE_LOCAL, "",
> Zmq.NO_LIMIT, Zmq.NO_LIMIT, Zmq.NO_LIMIT);
> zmq.Bind("daniele", "paperino", "", "");
> byte[] pippo;
> int theType;
> zmq.Receive(out pippo, out theType, true);
> zmq = null;
> }
> }
> }
>
>
> --
> Daniele Teti
> R&D Director & Educational
> bit Time Software
> www.bittime.it
> www.danieleteti.it
> www.codegear.it
> ------------------------------------------------------------------------
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
--
Daniele Teti
R&D Director & Educational
bit Time Software
www.bittime.it
www.danieleteti.it
www.codegear.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090717/4ee3a9c2/attachment.htm>
More information about the zeromq-dev
mailing list