[REBOL] Re: Maximum number of listening ports
From: compkarori:gm:ail at: 25-Feb-2010 2:37
Leon,
What does this supposed to do?
set-modes inputmulticast [multicast-groups: copy
compose/deep[[239.2.0.81 (mon-address)]] ]
The case statement is like this:
case [
condition [ ]
condition [ ]
true [ ]
]
Also, there's no 'continue ...
2010/2/25 Leon Meyer <lmeyer-bltech.co.za>:
> Thanks for the feedback up to now.
>
> I have know included an if statement to close the port if the COPY of
> the
> port (connstatus) returns NONE (thanks Gabrielle).
>
> I also included an if statement to insert the inputmulticast to the port
> if
> the COPY of the port (connstatus) does not equal NONE.
>
> Great, it works and ports are being closed now + memory no longer
> increases
> as ports are removed from the list, but I have picked up an issue. If
> the
> remote client hogs the port (in my case the telnet session to tcp port
> crashed), no other connections are possible from other tcp clients until
> that problem connection is closed. Then only can the rest of the
> connections
> connect to the tcp server again.
>
> In the code below, I think I should have rather used "continue" in the
> "if
> connstatus equals NONE" block, instead of the next "if connstatus not
> equals
> NONE". But when I use "continue" I get an error that says it has no
> value.
>
> "break" works, but I believe that would result in the remainder of the
> ports
> in the ports list would not be forwarded the data for that loop cycle.==
20
> Any feedback on the "One problem port stops all" issue perhaps?
>
> Code:
>
> REBOL [ Title: "4553"]
>
> =A0mon-address: read make url! join "dns://" (read dns://)
> =A0inputmulticast: open/direct/binary udp://:6553
> =A0set-modes inputmulticast [multicast-groups: copy
> compose/deep[[239.2.0.81
> (mon-address)]] ]
>
> listen: open/direct/binary/no-wait tcp://:4553
> output-ports: copy []
>
> forever [
> =A0 =A0port: wait [listen inputmulticast]
> =A0 =A0case [port = listen [append output-ports first listen]
> =A0 =A0'else [data: copy inputmulticast foreach port output-ports [
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0connstatus: copy port
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if none? connstatus [
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0close port
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0remove find output-ports port
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0]
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if connstatus <> none [insert port data]
> =A0 =A0 =A0 =A0 =A0 ]
> =A0 =A0 =A0 =A0]
> =A0 =A0]
> ]
>
> -----Original Message-----
> From: rebol-bounce-rebol.com [mailto:rebol-bounce-rebol.com] On Behalf
> Of
> Semseddin Moldibi
> Sent: Monday, February 22, 2010 9:53 AM
> To: rebolist-rebol.com
> Subject: [REBOL] Re: Maximum number of listening ports
>
> There is a number of connections limitation on Windows OS, there is a
> setting on registry. And closed ports don't be released immediately, so
> if
> you close and open too fast then you can reach the limit. The limit is
> different for OS versions.
>
> Mon, 22 Feb 2010 09:34:11 +0200 tarihinde Leon Meyer
> <lmeyer-bltech.co.za>
> =FE=F6yle yazm=FD=FE:
>
>>
>> I do apologise, I posted in HTML format before , below is the post in =A0
>
>> plain
>> text.
>>
>> Best Regards
>> Leon
>>
>>
>> ________________________________
>>
>> From: Leon Meyer [mailto:lmeyer-bltech.co.za]
>> Sent: Monday, February 22, 2010 7:33 AM
>> To: 'rebolist-rebol.com'
>> Subject: RE: Maximum number of listening ports
>>
>>
>> Hi
>> I did some further testing. It seems there there could be a limitation
> on
>> the number of sockets or connections made.
>> To speed up the failure result, I have setup a monitoring app that
>> checks if
>> the socket is open every 2 seconds(connects and disconnects). After 30
>> minutes, I can no longer access the listening port, although Windows ==
20
>> netstat
>> command still shows the port as open. The rebol app fails with the
>> following
>> error:
>> ** Access Error: Cannot connect to listen port
>> ** Where: forever
>> ** Near: append output-ports first listen
> <k=FDrp=FDlm=FD=FE>
>> Does it mean there is a problem with my rebol script or does my code
> not
>> release the every connection that is made. I have also noticed that
> the
>> memory usage for the rebol app is at 6Mb when it starts, but gradually
>
>> grows
>> over time to 15-20MB.
>> Thanks.
>>
>> Best Regards
>> Leon
>>
>>
>>
>> ________________________________
>>
>> From: Leon Meyer [mailto:lmeyer-bltech.co.za]
>> Sent: Saturday, February 20, 2010 12:43 PM
>> To: 'rebolist-rebol.com'
>> Subject: Maximum number of listening ports
>>
>>
>> Hi
>> We have been using a rebol script for a while now. Its main function
> is
>> to
>> forwards a Multicast stream to any TCP listening ports.
>> The script works 100%, but if there are a large number of requests
> from a
>> remote PC to the listening port, the rebcore process seems to close
> the
>> listen port eventually. This could sometimes only happen after a
> couple
>> of
>> days. Is there a limit on:
>> - the duration of the listen port being open?
>> - the number of requests that could made by the ?
>> Script:
>> REBOL [ Title: "4550"]
>> mon-address: read make url! join "dns://" (read dns://)
>> =A0inputmulticast: open/direct/binary udp://:6550
>> =A0set-modes inputmulticast [multicast-groups: copy
>> compose/deep[[239.2.0.81
>> (mon-address)]] ]
>> listen: open/direct/binary/no-wait tcp://:4550
>> output-ports: copy []
>> forever [
>> =A0 =A0 port: wait [listen inputmulticast]
>> =A0 =A0 case [
>> =A0 =A0 =A0 =A0 port = listen [
>> =A0 =A0 =A0 =A0 =A0 =A0 append output-ports first listen
>> =A0 =A0 =A0 =A0 ]
>> =A0 =A0 =A0 =A0 'else [
>> =A0 =A0 =A0 =A0 =A0 =A0 data: copy inputmulticast
>> =A0 =A0 =A0 =A0 =A0 =A0 foreach port output-ports [
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 insert port data
>> =A0 =A0 =A0 =A0 =A0 =A0 ]
>> =A0 =A0 =A0 =A0 ]
>> =A0 =A0 ]
>>
>> Best Regards
>> Leon
>>
>>
>
> --
> 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.
>
--
Graham Chiu
http://www.compkarori.co.nz:8090/
Synapse - the use from anywhere EMR.