about summary refs log tree commit diff
path: root/Functions/TCP/tcp_wait
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/TCP/tcp_wait')
-rw-r--r--Functions/TCP/tcp_wait11
1 files changed, 11 insertions, 0 deletions
diff --git a/Functions/TCP/tcp_wait b/Functions/TCP/tcp_wait
new file mode 100644
index 000000000..d18068a66
--- /dev/null
+++ b/Functions/TCP/tcp_wait
@@ -0,0 +1,11 @@
+# Wait for given number of seconds, reading any data from
+# all TCP connections while doing so.
+
+typeset -F SECONDS to end
+
+(( to = $1, end = SECONDS + to ))
+while (( SECONDS < end )); do
+  tcp_read -a -T $to
+  (( to = end - SECONDS ))
+done
+return