man page of the nc command has following information
-k Forces nc to stay listening for another connection after its current connection is completed. It is an error to use this option without the -l option.
But nc --help
output has not any information regarding to -k option.
And when I try to capture packages like
nc -kl -i 86400 -p 44444 > nc_44444.dmp
I got following error
netcat: invalid option -- 'k'
So what is the problem ? Is there any option called as "-k"
My problem is I have to capture some data from network and sometimes client application could disconnect from server port and it could reconnect again. So I don't want to get problem about disconnect/reconnect events
Linux 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
– Murat Mar 31 '15 at 13:35Red Hat Enterprise Linux Server release 6.6 (Santiago)
– Murat Mar 31 '15 at 13:39nc -h
. I suspect you're running busyboxnc
, which doesn't support-k
. Regularnc
has supported the-k
option since at least 2001 source. – Mikel Mar 31 '15 at 15:00nc
from the packagenetcat-traditional
, which has very few options and certainly nothing so newfangled as-k
. Fortunately there is alsonetcat-openbsd
, but it has to be installed manually. – Chris Davies Mar 31 '15 at 22:58The consultant installed netcat so I uninstalled netcat and then nc was not working. So I also removed and reinstalled nc again.
Now -k option is working now
Thanks for your helps – Murat Apr 01 '15 at 10:03