1. 37
  1. 14

    The best addition is that you can have a TLS connection too using ncat -lvnp 12345 –ssl

    You can even specify your certificate and key! Brillant :)

    1. 12

      I believe this should be tagged as self-submitted. (Unless I’m just misremembering the effect that has on colors?)

      1. 7

        Pleasantly, Plan 9 has the ability to trivially serve an HTTP server as a shell script, such as rc-httpd(8):


        You can get TLS without adding any code to your server(s) in Plan 9 as well by using tlssrv(8):


        1. 6

          Some years ago I wrote my own local development web server in a few dozen lines of bash. I could never get nc to work for serving concurrent requests (i.e. html+js+css at the same time) but ncat works great.

          It was actually really nice for prototyping with compile-to-js languages like ClojureScript or PureScript, as well as very quickly mocking up little CRUD apps. You’d write little executables to handle all the different HTTP verbs.


          i.e. start it up, POST /some/resource, and it’ll try to run ./some/resource/POST if that script exists, then fall back to parent directories. Kind of a cute little hack.

          1. 3

            I’ve enjoyed using Bernstein’s tcpserver for this exact thing. It doesn’t do TLS though.


          2. 3

            If ya wanna use this on macOS, I think you’ll need to replace -q with -G to set the timeout interval. Very cool!

            1. 2

              Or just omit -q all together.

            2. 3

              nc / netcat / ncat, there are so many not that compatible implementations, it’s one of the confusing tools I’ve ever used

              1. 3

                python -m http.server

                1. 4

                  Only works if python is installed…. and for files.

                  1. 3

                    http.server module also supports cgi support, so you could do more than files with it.

                2. 2

                  It’s been about 10 days that I setup socat for a test to provide a local web server to connect to with a client cert. Not the simplest anymore, but only one step above with a lot more features.