Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Maximum number of listening ports

 [1/10] from: lmeyer:bltech:za at: 20-Feb-2010 12:42


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://) inputmulticast: open/direct/binary udp://:6550 set-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 [ port: wait [listen inputmulticast] case [ port = listen [ append output-ports first listen ] 'else [ data: copy inputmulticast foreach port output-ports [ insert port data ] ] ] Best Regards Leon

 [2/10] from: lmeyer:bltech:za at: 22-Feb-2010 7:33


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 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
>>
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 Meyer _____ 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://) inputmulticast: open/direct/binary udp://:6550 set-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 [ port: wait [listen inputmulticast] case [ port = listen [ append output-ports first listen ] 'else [ data: copy inputmulticast foreach port output-ports [ insert port data ] ] ] Best Regards Leon

 [3/10] from: compkarori:gm:ail at: 22-Feb-2010 2:07


What happens if you close each port as it opens .. does it affect the number of connections? On Mon, Feb 22, 2010 at 6:33 PM, Leon Meyer <lmeyer-bltech.co.za> wrote:
> Hi > I did some further testing. It seems there there could be a limitation on
<<quoted lines omitted: 55>>
> 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.

 [4/10] from: lmeyer:bltech:za at: 22-Feb-2010 9:34


I do apologise, I posted in HTML format before , below is the post in 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 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
>>
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://) inputmulticast: open/direct/binary udp://:6550 set-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 [ port: wait [listen inputmulticast] case [ port = listen [ append output-ports first listen ] 'else [ data: copy inputmulticast foreach port output-ports [ insert port data ] ] ] Best Regards Leon

 [5/10] from: sqlab:gmx at: 22-Feb-2010 8:52


Hi Leon, of course there is a maximum of sockets an application can handle. But do not ask me how many.You have either to determine that by trial as you did or to ask the developer or check the OS. In your test and in your working service you should also close the connected port, you derived from the listening port, if your peer closes the port. And one more to optimize is a wait/all, as you can get more than one event with high traffic. regards AR On 22.02.2010 06:33, Leon Meyer wrote:

 [6/10] from: semseddinm:bircom at: 22-Feb-2010 9:52


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> şöyle yazmış:

 [7/10] from: lmeyer:bltech:za at: 22-Feb-2010 12:02


Hi Graham Yes, I believe you are on the right track. I have downloaded a utility called Socketsniff. It proves that it keeps every Socket open on the server even if the client closes the socket (telnet being the client in this case). As the server script copies the multicast stream to every connected socket, the number of active sockets just grows and grows until the new socket requests are declined. After a couple of minutes I had 100 open sockets within only 2 active clients. How do I build-in a check in the script below to see if the client's tcp port is still active and if not, close that tcp socket? REBOL [ Title: "4550"] mon-address: read make url! join "dns://" (read dns://) inputmulticast: open/direct/binary udp://:6550 set-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 [ 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 ] ] ] ] Thanks Leon

 [8/10] from: sqlab:gmx at: 22-Feb-2010 12:21


maybe this helps http://www.rebol.org/ml-display-thread.r?m=rmlZCZC On 22.02.2010 11:02, Leon Meyer wrote:

 [9/10] from: lmeyer:bltech:za at: 25-Feb-2010 9:03


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. 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 = 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] ] ] ] ]

 [10/10] from: compkarori::gmail 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
<<quoted lines omitted: 21>>
> 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:
<<quoted lines omitted: 60>>
>> 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
<<quoted lines omitted: 74>>
> 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.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted