summaryrefslogtreecommitdiffstats
path: root/stap-client
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2008-12-09 15:31:00 -0500
committerDave Brolley <brolley@redhat.com>2008-12-09 15:31:00 -0500
commit309cc9ecf51b082d6de8f1c3b0028c398daa395f (patch)
tree1dbfaf6a68ea919bd3df775b8e46992f6fd97498 /stap-client
parent4ffc629674ac7d1d84b93cb7fdca71953983f762 (diff)
downloadsystemtap-steved-309cc9ecf51b082d6de8f1c3b0028c398daa395f.tar.gz
systemtap-steved-309cc9ecf51b082d6de8f1c3b0028c398daa395f.tar.xz
systemtap-steved-309cc9ecf51b082d6de8f1c3b0028c398daa395f.zip
Use netcat or nc, whichever is available.
Diffstat (limited to 'stap-client')
-rwxr-xr-xstap-client11
1 files changed, 8 insertions, 3 deletions
diff --git a/stap-client b/stap-client
index 0ac9bd68..255551b3 100755
--- a/stap-client
+++ b/stap-client
@@ -29,6 +29,11 @@ function configuration {
tmpdir_prefix_client=stap.client
tmpdir_prefix_server=stap.server
avahi_service_tag=_stap._tcp
+
+ # We need either netcat or nc.
+ netcat=`which netcat 2>/dev/null`
+ test "X$netcat" = "X" && netcat=`which nc 2>/dev/null`
+ test "X$netcat" = "X" && fatal "ERROR: cannot find required program 'netcat' or 'nc' on PATH"
}
# function: initialization
@@ -386,7 +391,7 @@ function send_request {
# Send the request file.
for ((attempt=0; $attempt < 10; ++attempt))
do
- if nc -w10 $server $(($port+1)) < $tar_client > /dev/null 2>&1; then
+ if $netcat -w10 $server $(($port+1)) < $tar_client > /dev/null 2>&1; then
return;
fi
sleep 1
@@ -405,7 +410,7 @@ function receive_response {
# Retrieve the file. Wait for up to 5 minutes for a response.
for ((attempt=0; $attempt < 300; ++attempt))
do
- if nc -d $server $(($port+1)) > $tar_server 2>/dev/null; then
+ if $netcat -d $server $(($port+1)) > $tar_server 2>/dev/null; then
return;
fi
sleep 1
@@ -535,7 +540,7 @@ function choose_server {
function connect_to_server {
for ((attempt=0; $attempt < 10; ++attempt))
do
- if echo "request:" | nc -w10 $1 $2 >/dev/null 2>&1; then
+ if echo "request:" | $netcat -w10 $1 $2 >/dev/null 2>&1; then
return 0
fi
sleep 1