Unix/Linux Go Back    

Netcat ( nc -l ) as webserver

Emergency UNIX and Linux Support

Kindly Note - This is a Single User Post by Forum Member Corona688 Regarding:
Netcat ( nc -l ) as webserver.
Please Follow The Primary Link Above to View the Full Discussion.

Old Unix and Linux 12-15-2016
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
Join Date: Aug 2005
Last Activity: 30 March 2017, 11:38 AM EDT
Location: Saskatchewan
Posts: 22,021
Thanks: 1,065
Thanked 4,130 Times in 3,822 Posts
This is going to be a royal pain to do in the shell. You're going to get stuck waiting on input from the web service while the web browser is stuck waiting on input for you. Named pipes are prone to this, even used one-way -- using a pair means almost guaranteed deadlock.

If you have Python or Perl, I'd look into writing it in that language instead. You would use a socket directly, avoiding the need for these deadlocks.

Another alternative, which I know you didn't want, would be the expect language. It can work pretty much the way you were expecting - run a program, check if it's got input, check if it's got output, decide what do do with it, move on.