LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-05-2015, 12:04 PM   #1
BlueEmerald
LQ Newbie
 
Registered: Feb 2015
Posts: 1

Rep: Reputation: Disabled
netcat not stopping when program ends


I use the following command to setup netcat to read + write from a program from the command line:

./program < IN | nc -k -l 9001 >IN

Basically I have a fifo IN and take my inputs from it, and pipe the output to nc which pushes incoming commands to the IN fifo. -k to allow another connection if the user disconnects.

However, when the program ends and returns this command doesn't always end (and return to the command line). If I try to connect to the port again it seems to accept the connection but then close it immediately; however, my knowledge of how TCP connections are made and closed is low so I could be mistaking its behavior. A couple times it the program did end and return to the command line. I wonder if it has something to do with the other ends connection?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
i am trying to write a php program n ends up giving me parse error on line 21 shygvy Programming 6 05-09-2012 10:11 AM
netcat and my perl program humandynamo Linux - Software 3 02-01-2009 10:30 AM
run a program when X session ends tanoatlq Linux - Software 2 08-29-2008 03:10 AM
c++/going through vector ends program aral Programming 4 10-16-2006 12:34 PM
program name ends in question mark objectiveal Programming 5 05-11-2006 03:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration