Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2012-11-11 Thread Peter Thomas
I've only just come across this, after using clrzmq in the past. 
A couple of things needed updating (which you've probably already done,
bearing in mind your post is nearly a year old):-

All socket types can either Bind() or Connect(). 
You limit some of your sockets to doing one or the other, 
and the one they are allowed to do is sometimes not the usual choice. 
For example, it's usual for a Publish socket to Bind() and a
Subscriber socket to Connect() so that multiple subscribers can 
connect to a single publisher.

The could do with updating for ZeroMQ v3, which is now stable although 
still officially in beta. The update is largely just a replacement of 
all zmq_send calls with zmq_msg_send and zmq_recv with zmq_msg_recv. 
The order of the first two parameters will also need swapping, 
because of the symantic changes in ZeroMQ v3.

Having said all that, this is by far the best C# wrapper for ZMQ! 
It beats clrzmq hands down, great work  thanks for sharing it.


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2012-05-02 Thread Bennie Kloosteman
1. Ensure the DLL  has permissions to run on your local machines ( right
click properties) . This is not just for .net but exes also.
2. Make sure you are running in full trust .

Regards,

Ben

On Wed, May 2, 2012 at 1:18 PM, Thomas Fee  wrote:

> Hey Alex, sounds great but no way I can get it to work. It's probably
> because
> I'm a newb at this C# stuff. Would appreciate a quick look at this, a cut
> and
> paste of your code into a program "shell". At this point, I'm just trying
> to get
> it to compile, never mind have it work.
>
> What I did was copy the DLL (that came with your distro) into my C# project
> directory. Then in Solution Explorer, I added your DLL as a reference
> (using
> "Add Reference", then Browse tab).
>
> The compile error I get is
>
> 'ZeroMQ.ZmqSocket.Bind(string)' is inaccessible due to its protection level
>
> Ditto for .Connect(string).
>
> What does this mean? Would be great if you could write a beginner's
> tutorial. :-
> )
>
> Here is the code:
>
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using System.Windows;
> using System.Windows.Controls;
> using System.Windows.Data;
> using System.Windows.Documents;
> using System.Windows.Input;
> using System.Windows.Media;
> using System.Windows.Media.Imaging;
> using System.Windows.Navigation;
> using System.Windows.Shapes;
> using ZeroMQ;
>
> namespace WpfApplication1
> {
>public partial class MainWindow : Window
>{
>public MainWindow()
>{
>InitializeComponent();
>
>var publisher = new ZmqPublishSocket
>{
>Identity = Guid.NewGuid().ToByteArray(),
>RecoverySeconds = 10
>};
>
>publisher.Bind(address: "tcp://127.0.0.1:9292");
>var subscriber = new ZmqSubscribeSocket();
>subscriber.Connect(address: "tcp://127.0.0.1:9292");
>subscriber.Subscribe(prefix: ""); // subscribe to all messages
>subscriber.OnReceive += () =>
>{
>String message;
>subscriber.Receive(out message, nonblocking: true);
>Console.WriteLine(message);
>};
>
>publisher.Send("Hello world!");
>return 0;
>}
>}
> }
>
>
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2012-05-01 Thread Thomas Fee
Hey Alex, sounds great but no way I can get it to work. It's probably because 
I'm a newb at this C# stuff. Would appreciate a quick look at this, a cut and 
paste of your code into a program "shell". At this point, I'm just trying to 
get 
it to compile, never mind have it work.

What I did was copy the DLL (that came with your distro) into my C# project 
directory. Then in Solution Explorer, I added your DLL as a reference (using 
"Add Reference", then Browse tab).

The compile error I get is

'ZeroMQ.ZmqSocket.Bind(string)' is inaccessible due to its protection level

Ditto for .Connect(string).

What does this mean? Would be great if you could write a beginner's tutorial. :-
)

Here is the code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZeroMQ;

namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

var publisher = new ZmqPublishSocket
{
Identity = Guid.NewGuid().ToByteArray(),
RecoverySeconds = 10
};

publisher.Bind(address: "tcp://127.0.0.1:9292");
var subscriber = new ZmqSubscribeSocket();
subscriber.Connect(address: "tcp://127.0.0.1:9292");
subscriber.Subscribe(prefix: ""); // subscribe to all messages
subscriber.OnReceive += () =>
{
String message;
subscriber.Receive(out message, nonblocking: true);
Console.WriteLine(message);
};

publisher.Send("Hello world!");
return 0;
}
}
}


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-22 Thread Martin Sustrik
On 12/21/2010 07:57 PM, Alex Forster wrote:
>> For example, the names of inproc endpoints are stored in the
>> context. If library A uses inproc endpoint named X and library B
>> accidentally uses endpoint X as well, they start messining with
>> each other.
>
> That's a very good point, I'll definitely have to address that. I'm
> willing to jump through hoops to keep automatic context management,

Depends on the language runtime. If .NET has no way to keep two 
instances of the same library distinct and not messing with each other, 
you'll presumably have to have something like context. If .NET has a 
mechanism to separate the two, it's a non-issue.

> since it's such a perfect fit for RAII-esque language features, and
> API simplicity was my main motivation for a rewrite. Are there any
> other specific points of contention you can think off off-hand, or
> are there any fundamental issues that completely prevent it from
> working stably this way?

Multiple calls to zmq_init for example. If you just cache the context 
and reuse it as needed, the io_threads parameter won't be honoured the 
second time.

Martin
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Michael Compton
No problem, no offence taken, though in my personal opinion it's a
little counter productive to have many bindings targeting the same
language/framework.

The reason I created CLRZMQ2 was because I felt the original wasn't
idiomatic C# so I could hardly hold it against you, hehe.

The reference counting is a very good idea though, which had not
occurred to me. 

On Wed, 2010-12-22 at 00:51 +, Alex Forster wrote:
> > You do know that clrzmq2 supported all of what you mentioned besides the
> > reference counting.
> > 
> > If you had of submitted a patch for clrzmq2 it would have been very
> > welcome.
> 
> I certainly didn't mean to offend. I'll admit that, while I did have some
> different ideas as to what a C#-ified ZeroMQ API should look like, the biggest
> motivator for my rewrite was to become more familiar with ZeroMQ. You'll 
> notice
> that the p/invoke class (ZeroMQ.Interop) is heavily documented and tested - 
> that
> was purely for my benefit.
> 
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Alex Forster
> I notice NUZQ seems to use lambdas, these were introduced in .NET 3.0, I
> purposely kept clrzmq2 targeting .net 2.0. 
> 
> The fact is a 2.0 is the prevalent .NET framework, many large
> organization will actually only be using that. 
> 
> The application I maintain as a day job is targeted at 2.0 and I work
> for a very large investment bank.

While the project requires a .NET 3.5 compiler to transform the source into IL,
the resulting assembly will run on any ECMA-334 (.NET 2.0) compatible CLI. The
new language features added to C# in 3.5 all essentially boil down to
syntactical sugar. As long as you don't reference any core assemblies that are
3.5-specific (System.Linq, System.Windows, System.ServiceModel, etc) your
resulting assembly is .NET 2.0 compatible.

http://www.hanselman.com/blog/HowDoExtensionMethodsWorkAndWhyWasANewCLRNotRequired.aspx


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Alex Forster
> You do know that clrzmq2 supported all of what you mentioned besides the
> reference counting.
> 
> If you had of submitted a patch for clrzmq2 it would have been very
> welcome.

I certainly didn't mean to offend. I'll admit that, while I did have some
different ideas as to what a C#-ified ZeroMQ API should look like, the biggest
motivator for my rewrite was to become more familiar with ZeroMQ. You'll notice
that the p/invoke class (ZeroMQ.Interop) is heavily documented and tested - that
was purely for my benefit.

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Michael Compton
You do know that clrzmq2 supported all of what you mentioned besides the
reference counting.

If you had of submitted a patch for clrzmq2 it would have been very
welcome.

On Tue, 2010-12-21 at 09:00 -0200, Vinicius Chiele wrote:
> Great job Alex, your implementation is very clean and simple, I liked
> it.
> 
> Vinicius Chiele
> 
> 2010/12/21 Alex Forster 
> I have quite a few gripes with clrzmq and clrzmq2, and NZMQ is
> incomplete in several areas, so over a few weekends this past
> month I've written a new C# API for ZeroMQ based on the 2.0.10
> release of zmq.h.
> 
> 
> ZeroMQ Interop v0.8.190.10354 (beta)
> http://zeromq.codeplex.com
> 
> 
> * Feature-complete
> * MIT licensed
> * Targeted at both Microsoft and Mono .NET 2.0 CLRs (though it
> does require a 3.5 compatible compiler, basically for lambda
> syntax)
> * Includes binaries for both 32 and 64bit platforms (without
> any #ifdefs)
> 
> 
> Here's an example using Pub/Sub sockets-
> 
> 
> 
> > // Set up a publisher.
> > 
> > 
> > var publisher = new ZmqPublishSocket {
> > Identity = Guid.NewGuid().ToByteArray(),
> > RecoverySeconds = 10
> > };
> > 
> > 
> > publisher.Bind( address: "tcp://127.0.0.1:9292" );
> > 
> > 
> > // Set up a subscriber.
> > 
> > 
> > var subscriber = new ZmqSubscribeSocket();
> > 
> > 
> > subscriber.Connect( address: "tcp://127.0.0.1:9292" );
> > 
> > 
> > subscriber.Subscribe( prefix: "" ); // subscribe to all
> > messages
> > 
> > 
> > // Add a handler to the subscriber's OnReceive event
> > 
> > 
> > subscriber.OnReceive += () => {
> > 
> > 
> > String message;
> > subscriber.Receive( out message, nonblocking: true );
> > 
> > 
> > Console.WriteLine( message );
> > };
> > 
> > 
> > // Publish a message to all subscribers.
> > 
> > 
> > publisher.Send( "Hello world!" );
> 
> 
> A few things that make this sample stand out from the other
> two ZeroMQ C# libraries-
> 
> 
> * There's no need to manage your ZeroMQ context; it's taken
> care of on a per-AppDomain basis using refcounting.
> * There is no "message" object because it provides no added
> benefit in C#. Messages are simply Byte[]s, with overloads
> throughout the API that accept Strings.
> * First-class support for .NET events programming, implemented
> using zmq_poll() (but that's completely transparent to the
> user).
> 
> 
> I'd love some feedback. I'm just starting to use it in a
> project I'm working on, and so far it all seems to be working
> smoothly and at high throughput, but I'm releasing it as
> "beta" because I don't feel that it has enough real-world
> experience yet.
> 
> 
> Alex Forster
> 
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> 
> 
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Alex Forster
> For example, the names of inproc endpoints are stored in the context. If 
> library A uses inproc endpoint named X and library B accidentally uses 
> endpoint X as well, they start messining with each other.

That's a very good point, I'll definitely have to address that. I'm willing to 
jump through hoops to keep automatic context management, since it's such a 
perfect fit for RAII-esque language features, and API simplicity was my main 
motivation for a rewrite. Are there any other specific points of contention you 
can think off off-hand, or are there any fundamental issues that completely 
prevent it from working stably this way?
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Michael Compton
I'm the primary author and maintainer of clrzmq2, it monitor for issue
and will endeavour to resolve them when they arise. I monitor the
mailing list and drop into #zeromq now and then.

I notice NUZQ seems to use lambdas, these were introduced in .NET 3.0, I
purposely kept clrzmq2 targeting .net 2.0. 

The fact is a 2.0 is the prevalent .NET framework, many large
organization will actually only be using that. 

The application I maintain as a day job is targeted at 2.0 and I work
for a very large investment bank.


On Tue, 2010-12-21 at 13:07 -0500, Alex Forster wrote:
> > Great! I would suggest adding a link to your project to www.zeromq.org. 
> > It's wiki, so you can do so yourself.
> 
> Gladly, done.
> 
> > I am not familiar with CLR. Doesn't the problem the context is solving 
> > (i.e. zeromq being used from two libraries that are later on linked into a 
> > single application and step on each other toes) occur with .NET as well?
> 
> That is a very good question that I don't know if I can answer. I figured the 
> problem it was solving essentially boiled down to "no global variables". 
> Where is there an opportunity for undesirable interaction?
> 
> > A side issue: Wouldn't it make sense for you clrzmq, clrzmq2, NZMQ and 
> > Interop guys to at least start working on integration of all the projects? 
> > I mean, writing the code is easy, maintaining it and fixing the bugs is 
> > hard. If the projects are integrated into a single one you could support 
> > four time more features, fix four time more bug, make the whole binding 
> > four times more stable. Aside of that, having a community is much more fun 
> > than working alone :)
> 
> I'd be up for it. How active is clrzmq2? NZMQ seems to have stalled 3-4 
> months ago.
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Martin Sustrik
On 12/21/2010 07:07 PM, Alex Forster wrote:

>> I am not familiar with CLR. Doesn't the problem the context is
>> solving (i.e. zeromq being used from two libraries that are later
>> on linked into a single application and step on each other toes)
>> occur with .NET as well?
>
> That is a very good question that I don't know if I can answer. I
> figured the problem it was solving essentially boiled down to "no
> global variables". Where is there an opportunity for undesirable
> interaction?

For example, the names of inproc endpoints are stored in the context. If 
library A uses inproc endpoint named X and library B accidentally uses 
endpoint X as well, they start messining with each other.

>> A side issue: Wouldn't it make sense for you clrzmq, clrzmq2, NZMQ
>> and Interop guys to at least start working on integration of all
>> the projects? I mean, writing the code is easy, maintaining it and
>> fixing the bugs is hard. If the projects are integrated into a
>> single one you could support four time more features, fix four time
>> more bug, make the whole binding four times more stable. Aside of
>> that, having a community is much more fun than working alone :)
>
> I'd be up for it. How active is clrzmq2? NZMQ seems to have stalled
> 3-4 months ago.

I don't know. Try pinging the authors...

Martin
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Alex Forster
> Great! I would suggest adding a link to your project to www.zeromq.org. It's 
> wiki, so you can do so yourself.

Gladly, done.

> I am not familiar with CLR. Doesn't the problem the context is solving (i.e. 
> zeromq being used from two libraries that are later on linked into a single 
> application and step on each other toes) occur with .NET as well?

That is a very good question that I don't know if I can answer. I figured the 
problem it was solving essentially boiled down to "no global variables". Where 
is there an opportunity for undesirable interaction?

> A side issue: Wouldn't it make sense for you clrzmq, clrzmq2, NZMQ and 
> Interop guys to at least start working on integration of all the projects? I 
> mean, writing the code is easy, maintaining it and fixing the bugs is hard. 
> If the projects are integrated into a single one you could support four time 
> more features, fix four time more bug, make the whole binding four times more 
> stable. Aside of that, having a community is much more fun than working alone 
> :)

I'd be up for it. How active is clrzmq2? NZMQ seems to have stalled 3-4 months 
ago.
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Vinicius Chiele
Great job Alex, your implementation is very clean and simple, I liked it.

Vinicius Chiele

2010/12/21 Alex Forster 

> I have quite a few gripes with clrzmq and clrzmq2, and NZMQ is incomplete
> in several areas, so over a few weekends this past month I've written a new
> C# API for ZeroMQ based on the 2.0.10 release of zmq.h.
>
> ZeroMQ Interop v0.8.190.10354 (beta)
> http://zeromq.codeplex.com
>
> * Feature-complete
> * MIT licensed
> * Targeted at both Microsoft and Mono .NET 2.0 CLRs (though it does require
> a 3.5 compatible compiler, basically for lambda syntax)
> * Includes binaries for both 32 and 64bit platforms (without any #ifdefs)
>
> Here's an example using Pub/Sub sockets-
>
> // Set up a publisher.
>
> var publisher *=* new *ZmqPublishSocket* {
>  Identity *=* *Guid**.**NewGuid*()*.**ToByteArray*(),
>  RecoverySeconds *=* 10
> };
>
> publisher*.**Bind*( address: "tcp://127.0.0.1:9292" );
>
> // Set up a subscriber.
>
> var subscriber *=* new *ZmqSubscribeSocket*();
>
> subscriber*.**Connect*( address: "tcp://127.0.0.1:9292" );
>
> subscriber*.**Subscribe*( prefix: "" ); // subscribe to all messages
>
> // Add a handler to the subscriber's OnReceive event
>
> subscriber*.**OnReceive* *+=* () *=>* {
>
> *String* message;
>  subscriber*.**Receive*( out message, nonblocking: true );
>
> *Console**.**WriteLine*( message );
> };
>
> // Publish a message to all subscribers.
>
> publisher*.**Send*( "Hello world!" );
>
>
> A few things that make this sample stand out from the other two ZeroMQ C#
> libraries-
>
> * There's no need to manage your ZeroMQ context; it's taken care of on a
> per-AppDomain basis using refcounting.
> * There is no "message" object because it provides no added benefit in C#.
> Messages are simply Byte[]s, with overloads throughout the API that accept
> Strings.
> * First-class support for .NET events programming, implemented using
> zmq_poll() (but that's completely transparent to the user).
>
> I'd love some feedback. I'm just starting to use it in a project I'm
> working on, and so far it all seems to be working smoothly and at high
> throughput, but I'm releasing it as "beta" because I don't feel that it has
> enough real-world experience yet.
>
> Alex Forster
>
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-21 Thread Martin Sustrik
Hi Alex,

> I have quite a few gripes with clrzmq and clrzmq2, and NZMQ is
> incomplete in several areas, so over a few weekends this past month I've
> written a new C# API for ZeroMQ based on the 2.0.10 release of zmq.h.

Great! I would suggest adding a link to your project to www.zeromq.org. 
It's wiki, so you can do so yourself.

You can add the link to existing .NET binding page or create a new page. 
If the page name starts with "binding:" it will be added to the list of 
bindings automatically.

> A few things that make this sample stand out from the other two ZeroMQ
> C# libraries-
>
> * There's no need to manage your ZeroMQ context; it's taken care of on a
> per-AppDomain basis using refcounting.

I am not familiar with CLR. Doesn't the problem the context is solving 
(i.e. zeromq being used from two libraries that are later on linked into 
a single application and step on each other toes) occur with .NET as well?

> * There is no "message" object because it provides no added benefit in
> C#. Messages are simply Byte[]s, with overloads throughout the API that
> accept Strings.

Fair enough. If there's no support for zero-copy, simply using byte 
arrays is the best way to go.

> * First-class support for .NET events programming, implemented using
> zmq_poll() (but that's completely transparent to the user).

Nice.

> I'd love some feedback. I'm just starting to use it in a project I'm
> working on, and so far it all seems to be working smoothly and at high
> throughput, but I'm releasing it as "beta" because I don't feel that it
> has enough real-world experience yet.

A side issue: Wouldn't it make sense for you clrzmq, clrzmq2, NZMQ and 
Interop guys to at least start working on integration of all the 
projects? I mean, writing the code is easy, maintaining it and fixing 
the bugs is hard. If the projects are integrated into a single one you 
could support four time more features, fix four time more bug, make the 
whole binding four times more stable. Aside of that, having a community 
is much more fun than working alone :)

Martin
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


[zeromq-dev] I've written a completely new C# API for ZeroMQ

2010-12-20 Thread Alex Forster
I have quite a few gripes with clrzmq and clrzmq2, and NZMQ is incomplete in 
several areas, so over a few weekends this past month I've written a new C# API 
for ZeroMQ based on the 2.0.10 release of zmq.h.

ZeroMQ Interop v0.8.190.10354 (beta)
http://zeromq.codeplex.com

* Feature-complete
* MIT licensed
* Targeted at both Microsoft and Mono .NET 2.0 CLRs (though it does require a 
3.5 compatible compiler, basically for lambda syntax)
* Includes binaries for both 32 and 64bit platforms (without any #ifdefs)

Here's an example using Pub/Sub sockets-

> // Set up a publisher.
> 
> var publisher = new ZmqPublishSocket {
>   Identity = Guid.NewGuid().ToByteArray(),
>   RecoverySeconds = 10
> };
> 
> publisher.Bind( address: "tcp://127.0.0.1:9292" );
> 
> // Set up a subscriber.
> 
> var subscriber = new ZmqSubscribeSocket();
> 
> subscriber.Connect( address: "tcp://127.0.0.1:9292" );
> 
> subscriber.Subscribe( prefix: "" ); // subscribe to all messages
> 
> // Add a handler to the subscriber's OnReceive event
> 
> subscriber.OnReceive += () => {
> 
>   String message;
>   subscriber.Receive( out message, nonblocking: true );
> 
>   Console.WriteLine( message );
> };
> 
> // Publish a message to all subscribers.
> 
> publisher.Send( "Hello world!" );


A few things that make this sample stand out from the other two ZeroMQ C# 
libraries-

* There's no need to manage your ZeroMQ context; it's taken care of on a 
per-AppDomain basis using refcounting.
* There is no "message" object because it provides no added benefit in C#. 
Messages are simply Byte[]s, with overloads throughout the API that accept 
Strings.
* First-class support for .NET events programming, implemented using zmq_poll() 
(but that's completely transparent to the user).

I'd love some feedback. I'm just starting to use it in a project I'm working 
on, and so far it all seems to be working smoothly and at high throughput, but 
I'm releasing it as "beta" because I don't feel that it has enough real-world 
experience yet.

Alex Forster___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev