Hi 

Wow, this email list rock!! I have only joined this morning and the now I
have a working solution!!!

Thank you to all the guys who gave me feedback (Graham Chiu, David May, AR
from SQLLab, Petr Krenzelok, Shaun Valerio and Gabrielle Santilli).

Have a great day
Leon

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Gabriele Santilli
Sent: Wednesday, November 18, 2009 12:12 PM
To: [email protected]
Subject: [REBOL] Re: UDP Multicast to TCP


On Wed, Nov 18, 2009 at 5:05 AM, Leon Meyer <[email protected]> wrote:

> Here is the code:

I'd do it this way:

> REBOL [ Title: "Multicast Receiver"]
>
> mon-address: read make url! join "dns://" (read dns://)
> inputmulticast: open udp://:6554
> set-modes inputmulticast [multicast-groups: copy compose/deep 
> [[239.2.0.81 (mon-address)]] ]

listen: open/direct/no-wait tcp://:4554
; copy not really needed here,
; but just in case you move this to a function for eg.
output-ports: copy []

forever [
    port: wait [listen inputmulticast]
    case [
        port = listen [
            ; we got a new connection
            ; let's add it to the list of output ports
            append output-ports first listen
        ]
        'else [
            ; some data incoming
            data: copy inputmulticast
            foreach port output-ports [
                insert port data
            ]
        ]
    ]
]

(You'll need to also handle the case of any of your output-ports being
closed, and you'll probably want to figure out a way to tell the server to
quit, etc.)
--
To unsubscribe from the list, just send an email to lists at rebol.com with
unsubscribe as the subject.
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to