polling ports with 'wait'
[1/4] from: alfred_pang::inetco::com at: 11-Aug-2000 10:20
Hello,
In version 2.2 core, I used to have something like this
to instantly poll a TCP connection if it has any data:
wait [0 conn]
If there is no data, then none was returned; otherwise
there is data on the connection.
I haven't been able to figure out the right thing to do
in 2.3 core; 'wait [0 conn]' always returned none even
if there is data available.
Any ideas on how to do it in 2.3?
-Alfred
[2/4] from: jelinem1:nationwide at: 11-Aug-2000 12:40
I noticed this also almost instantly after installing 2.3. I found no
documentation describing this change. 'wait still works if you give it a
non-zero time, so i ended up (after failed attempts at making the "no wait"
scenario work) using the smallest time frame REBOL would allow, 0:0:0.001.
Since I'm not constantly looping millions of times in a batch process this
does not significantly slow my program down. Thus, try:
wait [0:0:0.001 conn]
- Michael Jelinek
[Alfred_Pang--inetco--com] on 08/11/2000 12:20:08 PM
From: [Alfred_Pang--inetco--com] on 08/11/2000 12:20 PM
Please respond to [list--rebol--com]
To: [list--rebol--com]
cc:
Subject: [REBOL] polling ports with 'wait'
Hello,
In version 2.2 core, I used to have something like this
to instantly poll a TCP connection if it has any data:
wait [0 conn]
If there is no data, then none was returned; otherwise
there is data on the connection.
I haven't been able to figure out the right thing to do
in 2.3 core; 'wait [0 conn]' always returned none even
if there is data available.
Any ideas on how to do it in 2.3?
-Alfred
[3/4] from: galtbarber:mailandnews at: 11-Aug-2000 17:10
I just reported this to feedback,
and they have verified it.
They think it is likely a bug instead of a feature.
So, they know about it now.
I discovered the tcp-wait bug while creating my web-site
load-tester program in Rebol. Works pretty well.
Just tested 450 virtual users last night.
I made IIS beg for mercy (HTTP/1.1 500 Server Too Busy).
-Galt
[4/4] from: galtbarber:mailandnews at: 11-Aug-2000 17:16
Yeah, that is a good workaround.
However, 0 is still supposed to work.
Also, when I was testing my loadtester,
I would occasionally (like about every 8 seconds or so)
see the system pause for up to a second,
when using wait [port 0.001],
and at those times the cpu was not busy
so it couldnt be garbage collection or anything.
If I am running another rebol instance,
it does pause also, but not at the same
times as the 1st instance, so it's not likely
to be an os system background thread sucking
up the cycles.
I don't know if it is a bug or not,
but probably it has no relation to the problem
with wait [tcpport 0]
-Galt