LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-02-2012, 02:23 PM   #1
ezekieldas
Member
 
Registered: Mar 2010
Posts: 122

Rep: Reputation: 16
netcat as simple http server (or just prints a message)


There's this excellent example of how to use netcat as a simple httpd server (link below) but when I attempted to recreate this I found my netcat doesn't have the -c (dash c) option available. Unfortunately the systems I must configure for testing are fairly restricted so I'm not able to compile a special netcat or whatever. I tried doing 'nc -k -l 555555 </tmp/foo' which prints "hello world" but this only prints the contents of the file for a single connection.

Can anyone offer an example like this that would work with my nc (nc-1.84-22)?

http://ubuntuforums.org/showthread.php?t=828870
 
Old 06-02-2012, 02:36 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Get a different nc version that does have that option.

man nc for options.

Not all versions have all options. The -c is a string.

"c string
specify shell commands to exec after connect (use with caution). The string is passed to /bin/sh -c for execution. See the -e option if you don't have a working /bin/sh (Note that POSIX-conformant system must have one). "
http://pwet.fr/man/linux/commandes/nc
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
netcat error message ? gazza Linux - Networking 1 01-01-2014 06:06 AM
using netcat to make a simple proxy nassefk Linux - Networking 6 11-22-2010 03:29 PM
[SOLVED] Bash and netcat: Stripping http header Prokke Programming 9 10-05-2009 02:58 AM
LXer: Start Simple HTTP Server with Python LXer Syndicated Linux News 0 09-24-2009 12:40 PM
LXer: Tech Tip: Really Simple HTTP Server with Python LXer Syndicated Linux News 0 09-22-2009 08:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:38 AM.

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