impromptu web server using netcat
David J Berube
djberube at berubeconsulting.com
Sun Jan 14 16:31:54 EST 2007
Hi,
Here's a one-line web server command in ruby:
ruby -e "require 'webrick';
s=WEBrick::HTTPServer.new(:DocumentRoot=>Dir::pwd,:Port=>9999);
trap('INT'){s.shutdown}; s.start"
Complements of here:
http://brianellin.com/blog/2006/03/30/one-line-webserver-in-ruby/
Note that the netcat is considerably lighter weight than either the
Python or Ruby intepreters. Also note that there is a nice degree of
elegance in that the NetCat solution serves one file and only one file.
Take it easy,
David Berube
Berube Consulting
djberube at berubeconsulting.com
(603)-485-9622
http://www.berubeconsulting.com/
Kent Johnson wrote:
> aluminumsulfate at earthlink.net wrote:
>> Hi, All...
>>
>> Most of you are probably familiar with the ever useful TCP/IP utility
>> "netcat" (often /usr/bin/nc). It's real handy for doing quick and
>> easy file transfers, or otherwise tossing bytes about on a network.
>> It runs on most variants of UNIX (including Linux) and there's even a
>> version for Win32.
>
> If you have Python installed on the source machine, the single line
> python -c "import SimpleHTTPServer; SimpleHTTPServer.test()"
>
> will start a real web server on port 8000, serving static content from
> the directory tree rooted at the current working dir. The server
> includes support for directory listings and will set the correct
> content-type for many types of files.
>
> Kent
>
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>
>
More information about the gnhlug-discuss
mailing list