[zeromq-dev] C#Client
Daniele Teti
d.teti at bittime.it
Fri Jul 17 15:57:21 CEST 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090717/04fefed1/attachment.htm>
More information about the zeromq-dev
mailing list