aboutsummaryrefslogtreecommitdiff
path: root/tests/tcpclient_reflect.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcpclient_reflect.sh')
-rwxr-xr-xtests/tcpclient_reflect.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/tcpclient_reflect.sh b/tests/tcpclient_reflect.sh
new file mode 100755
index 0000000..88ada91
--- /dev/null
+++ b/tests/tcpclient_reflect.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+
+PIPEFILE="pipe.$$"
+
+control_c()
+# run if user hits control-c
+{
+ echo -en "\n*** Ouch! Exiting ***\n"
+ rm -f ${PIPEFILE}
+ exit $?
+}
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+echo "register Ctrl-C"
+trap control_c SIGINT
+
+echo "make pipe"
+mknod ${PIPEFILE} p
+echo "start client"
+cat ${PIPEFILE} | nc -w 10 localhost ${PORT} > ${PIPEFILE}
+echo "client quit"
+rm ${PIPEFILE}