1

from some time I'm trying to resolve very annoying issue:

I need to have simple server which will listen on particular TCP port and throw all information which it recieve to trash. I'm doing it by running ncat:

ncat -l 192.168.1.1 49111 -k -m 50

As everyting is working fine I want to run ncat in background. After some testing I decided to keep it running with screen:

screen -dm ncat -l 192.168.1.1 49111 -k -m 50

And still - everything is working fine except one thing: it refuses connections from time to time, no matter what is after -m parameter. Sometimes after few minutes, sometimes after few hours... Only way to make it working is to kill process and start it again.

Did you have similar problems? Or maybe you can suggest me another solution? I'm working at Virtualized workstation with CentOS. Do you think working at VM might cause this issue?

1
  • I'm trying on my machine without any problem. Just to be sure that -m option is the number of concurrent connections, so please check if you make more than 50 connections at that time or is there any zombie connection that was in time-wait status. You probably want to see "netstat -nat | grep 49111" output for that purpose.
    – incous
    Oct 22, 2015 at 6:19

2 Answers 2

0

If running it in the background is your problem, you can use nohup instead of screen

nohup ncat -l 192.168.1.1 49111 -k -m 50 &

You can then use fg, bg, jobs to interact with it if needed, as long as you don't exit the shell.

If ncat is the problem, please provide more information about what you're trying to do.

You could use tcpserver from ucspi-tcp

tcpserver 192.168.1.1 49111 cat > /dev/null

2
  • I need to keep it running after I log out from console. Oct 23, 2015 at 9:55
  • @PawełWojtal The point of nohup is to run things in the background, even when you've logged out. Oct 23, 2015 at 10:20
-1

Perhaps try running the discard service from the xinetd package?

2
  • 2
    You would need to explain a lot better how is supposed to help.
    – Sven
    Oct 22, 2015 at 18:03
  • I don't see any reason for the down votes. This is a good idea that could work very well for the OP if he decides he likes it. en.wikipedia.org/wiki/Discard_Protocol . Any professional sysadmin can read the man page for inetd and set this up. The OP did ask for "another solution" and wasn't clear about the specific requirements. Oct 23, 2015 at 10:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .