[REBOL] UDP Multicast to TCP
From: lmeyer:bltech:za at: 18-Nov-2009 6:05
Hi
This is my first post. I only discovered Rebol a couple of days ago, and
wow, I love it!
I need some help though with something that I am sure of is very basic, but
I have been struggling to get it right.
I am converting an incoming UDP stream to TCP. The TCP is forwarded to
anyone that connects to the TCP port. It works perfectly for our application
on the local PC.
Here is the code:
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)]] ]
tcpoutput: open/direct/no-wait tcp://:4554
forever [
tcp: first tcpoutput
until [ error? try [
receive: wait inputmulticast
insert tcp copy receive
]
]
close tcp
]
The problem is that it does not work with multiple incoming requests, only
with one. The other tcp ports are able to connect, but they do not receive
any data. Only the first client session receives the data. I do not need to
wait for an input from the client to start forwarding the data, hence the
absence of the "wait tcp".
I use multiple telnet sessions to the open TCP port.
I have tried to create a server as described in
http://www.rebol.net/cookbook/recipes/0034.html but I cannot get it to work.
This cookbook example also includes the "wait waitports" which we need to
exclude as we need to push data to the client as soon as it connects.
Any input on how would you need to go about pushing a TCP data stream to
multiple connected client ports at the same time.
Thank you
Leon