[zeromq-dev] ForwarderDevice in .Net c#

Noel Anderton noelAnderton at cox.net
Tue Mar 12 23:19:59 CET 2013


I have tried but this example is out of date. The recommended library is the
3.0 version, this code looks like it is from the 2.0 version. Are there any
examples available for the current version?

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org
[mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
Sent: Saturday, March 9, 2013 10:52 AM
To: ZeroMQ development list
Subject: Re: [zeromq-dev] ForwarderDevice in .Net c#

Hi Noel,

You have worked through the Guide and its examples? In Chapter 3 there's a
rrbroker example which shows this loop, and it's available in C#.

-Pieter

On Sat, Mar 9, 2013 at 6:05 PM, Noel Anderton <noelAnderton at cox.net> wrote:
> Thanks for the help, I am trying it right now, but the problem with 
> this is I am new to this and I am not sure about what is happening. It 
> is a very strange (to me) programming practice to put something in an 
> endless loop and have it just spinning, is this correct? Sometimes 
> threads block on receiving a message, why do they block sometimes and 
> spin through the loop other times. Which is better?
>
> When you say that I can replace the forwarder is it because the  .Net 
> bindings are only in Beta and it does not work?
>
> Thanks Noel
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org
> [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter 
> Hintjens
> Sent: Saturday, March 9, 2013 12:08 AM
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] ForwarderDevice in .Net c#
>
> Hi Noel.
>
> You can replace the call to the forwarder with your own loop. The logic
is:
>
> * poll for input on both sockets
> * when you get input on one socket, read all parts and write to the 
> other socket
>
> It's a short loop and writing it yourself will help you debug the 
> problem (which may be elsewhere).
>
> -Pieter
>
> On Sat, Mar 9, 2013 at 2:51 AM, Noel Anderton <noelAnderton at cox.net>
wrote:
>> Hi, I am having no luck getting a Forwarder device working with C# 
>> bindings
>>
>>
>>
>> I have created my own rudimentary forwarder the code is here 
>> http://pastebin.com/jwLF68Um
>>
>>
>>
>> I can connect to both the front and backend and publish to, and 
>> successfully subscribe to this, but when I try to do the same with 
>> the ForwarderDevice it does not work.
>>
>>
>>
>>
>>
>> My code for the forwarder looks like this
>>
>>
>>
>> ForwarderDevice = new ForwarderDevice(context, "tcp://*:5550", 
>> "tcp://*:5553", DeviceMode.Threaded);
>>
>> ForwarderDevice.Start();
>>
>> while (!ForwarderDevice.IsRunning)
>>
>> { }
>>
>>
>>
>> The publisher and subscriber both connect and they are unchanged from 
>> my home grown one that works and the provided one that I cant get to 
>> work
> yet.
>>
>>
>>
>> Front end
>>
>> Publisher.connect("tcp://localhost:5550")
>>
>>
>>
>> Back end
>>
>> Subscriber.Connect("tcp://localhost:5553");
>>
>>
>>
>> I am sending a multipart message , but I never receive anything.
>>
>>
>>
>> Any help is appreciated
>>
>>
>>
>> thanks
>>
>> Noel
>>
>>
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list