Hi Leon,

you wait on a list of ports, but you feed only the first tcp port.

You should insert your data in all connected tcp ports
e.g.

foreach port waitports [
     if all [
         port <> listen
         port <>inputmulticast
     ][
         insert port datafromudp
     ]
]

Of course, I assume that you wait on your udp port too

The other way would be to use an awake function.

AR



On 18.11.2009 08:18, Leon Meyer wrote:
>   Hi Graham
>
> Yes, I believe you are right.
>
> So I went and created a TCP Server port code as per the cookbook example:
>
> REBOL[Title: "Port 4550"]
>
> mon-address: read make url! join "dns://" (read dns://)
> inputmulticast: open udp://:6550
> set-modes inputmulticast [multicast-groups: copy compose/deep [[239.2.0.81
> (mon-address)]] ]     
>
> listen: open/direct/no-wait tcp://:4550
> waitports: [listen]
>
> forever [
>          data: wait waitports
>         print "client connected"
>          either same? data listen [
>              active-port: first listen
>              append waitports active-port
>          ][
>               insert data copy inputmulticast
>          ]
>      ]
>
> There are 2 problems with this script for me:
> 1. Only the first tcp connection still receives the data. Subsequent
> connections can access the port, but does not receive any data
> 2. I have to press any key (like spacebar) for the first connection to
> receive data. I believe it is the "wait waitports" statement that creates
> this scenario, but without it the code does not work at all.
>
> It seems like the "insert data copy inputmulticast" is preventing any
> subsequent connections from getting the data. The reason I say this is
> because I only see the "client connected" message after the first
> connection. For any subsequent connections the "client connected" never
> appears although the clients are connected using telnet to port tcp 4550.
>
> I am really stuck here. Do you know of anyone to assist me with this as we
> would even consider paying a fee to get this sorted out?
>
> Thank you
> Leon
>
> -----Original Message-----
> Subject: [REBOL] Re: UDP Multicast to TCP
>
>
> It looks like you take the first connection and only deal with that one.
> You need to keep listening on tcpoutput for other incoming connections.
> You only check again when you get an error.
>
> On Wed, Nov 18, 2009 at 5:05 PM, Leon Meyer<[email protected]>  wrote:
>    
>> 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, b=
>>      
> ut
>    
>> 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
>> applicat=
>>      
> ion
>    
>> 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.8=
>>      
> 1
>    
>> (mon-address)]] ]
>>
>> tcpoutput: open/direct/no-wait tcp://:4554
>>
>> forever [
>> tcp: first tcpoutput
>> until [ =A0error? try [
>> receive: wait inputmulticast
>> insert tcp copy receive
>> ]
>> ]
>> close tcp
>> ]
>>
>> The problem is that it does not work with multiple incoming requests,
>> onl=
>>      
> y
>    
>> with one. The other tcp ports are able to connect, but they do not
>> receiv=
>>      
> e
>    
>> 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
>> wo=
>>      
> rk.
>    
>> 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
>>
>>
>>
>> --
>> To unsubscribe from the list, just send an email to lists at rebol.com
>> with unsubscribe as the subject.
>>
>>
>>      
>
>
> --=20
> Graham Chiu
> http://www.synapsedirect.com
> Synapse - the use from anywhere EMR.
> --
> 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