Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behavior for GNU Netcat on HP-UX

Brian McEntire
Frequent Advisor

Strange behavior for GNU Netcat on HP-UX

Hello,
Has anyone else seen the following behavior or know of workarounds?

GNU Netcat, in my previous experience, will terminate immediately when stdin finishes. But, when I compiled netcat-0.7.1 for HP-UX (10.20) the program works but does not terminate without a control-C.

Expected behavior is seen when netcat listens on HP host and Linux host sends following:
echo hello | nc

hello is echo'd on the server/listening side and then netcat on both sides exit.

Unexpected behavior is seen when the roles are reversed, listener is Linux and sender is HP-UX:
echo hello | nc

hello is echo'd on the Linux listening side, however, neither end subsequently drops the connection.

Any ideas? I want the original (at least from what I've seen) behavior on HP-UX sender side so I can accurately time a transfer.

Thanks!
3 REPLIES
Ralph Grothe
Honored Contributor

Re: Strange behavior for GNU Netcat on HP-UX

I guess the -w switch isn't what you are looking for?
Madness, thy name is system administration
Brian McEntire
Frequent Advisor

Re: Strange behavior for GNU Netcat on HP-UX

No... But, you got me thinking, thanks! Here's the answer:

-c "close connection on EOF from stdin"

That causes it to work on the sending side as it does by default in Redhat Linux 7.2.

I'd read the man page and the info page, neither discussed the -c option. But then I ran nc --help on the HP side and saw a more complete list of options. -c does the trick.

Thanks again, -B
FT1
Occasional Visitor

Re: Strange behavior for GNU Netcat on HP-UX

How did you compile netcat on HP-UX 10.20?
Could you write little more about this or provide some recipe for this?