[zeromq-dev] I've written a completely new C# API for ZeroMQ
Bennie Kloosteman
bklooste at gmail.com
Wed May 2 10:43:39 CEST 2012
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 <angrydog at hotmail.com> 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 at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120502/19da8199/attachment.htm>
More information about the zeromq-dev
mailing list