Package: netcat-openbsd
Version: 1.89-4
Severity: normal

I was using this shell script to stress-test a TCP server I'm working on:

> #!/bin/bash
> 
> action() {
>     local delay=$1; shift
>     local n=$1; shift
> 
>     while [ $((n--)) -gt 0 ] ; do
>         echo foobar
>         sleep $delay
>     done
> }
> 
> action $1 $2 | nc -C some-host some-port | wc

The server takes CRLF-separated commands/requests, and I was puzzled when
I found that it reported receiving fewer commands than I sent.

After debugging the server for a while with no luck, I finally saw that
the TCP stream from netcat contained some "foobar\nfoobar\r\n" patterns, e.g.
immediately after connection.

Whatever method the -C option uses to ensure translation of CR to CRLF, it's
not foolproof.  Maybe only slow manual input was considered.

My workaround was to stop using -C, and to add CRLF explicitly using
echo -ne foobar\r\n instead.

BR,
Jorgen

-- System Information:
Debian Release: 6.0.7
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: powerpc (ppc)

Kernel: Linux 3.4.10
Locale: LANG=sv_SE, LC_CTYPE=sv_SE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages netcat-openbsd depends on:
ii  libc6                         2.11.3-4   Embedded GNU C Library: Shared lib
ii  libglib2.0-0                  2.24.2-1   The GLib library of C routines

netcat-openbsd recommends no packages.

netcat-openbsd suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to