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"]

 mon-address: read make url! join "dns://" (read dns://)
 inputmulticast: open/direct/binary udp://:6553
 set-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 [
    port: wait [listen inputmulticast]
    case [port =3D listen [append output-ports first listen]
    'else [data: copy inputmulticast foreach port output-ports [
                connstatus: copy port
                if none? connstatus [
                        close port
                        remove find output-ports port
                ]
                if connstatus <> none [insert port data]
           ]
        ]
    ]
]


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf =
Of
Semseddin Moldibi
Sent: Monday, February 22, 2010 9:53 AM
To: [email protected]
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 =
<[email protected]>
=FE=F6yle yazm=FD=FE:

>
> I do apologise, I posted in HTML format before , below is the post in  =

> plain
> text.
>
> Best Regards
> Leon
>
>
> ________________________________
>
> From: Leon Meyer [mailto:[email protected]]
> Sent: Monday, February 22, 2010 7:33 AM
> To: '[email protected]'
> 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 =20
> 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 =20
> 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 =
=20
> grows
> over time to 15-20MB.
> Thanks.
>
> Best Regards
> Leon
>
>
>
> ________________________________
>
> From: Leon Meyer [mailto:[email protected]]
> Sent: Saturday, February 20, 2010 12:43 PM
> To: '[email protected]'
> Subject: Maximum number of listening ports
>
>
> Hi
> We have been using a rebol script for a while now. Its main function =
is =20
> 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 =20
> 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://)
>  inputmulticast: open/direct/binary udp://:6550
>  set-modes inputmulticast [multicast-groups: copy =20
> compose/deep[[239.2.0.81
> (mon-address)]] ]
> listen: open/direct/binary/no-wait tcp://:4550
> output-ports: copy []
> forever [
>     port: wait [listen inputmulticast]
>     case [
>         port =3D listen [
>             append output-ports first listen
>         ]
>         'else [
>             data: copy inputmulticast
>             foreach port output-ports [
>                 insert port data
>             ]
>         ]
>     ]
>
> Best Regards
> Leon
>
>


--=20
To unsubscribe from the list, just send an email to=20
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