Skip to content

Instantly share code, notes, and snippets.

@davidblewett
Created October 3, 2018 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidblewett/1d9ad0f09274ad4adf8d7b6c403622ac to your computer and use it in GitHub Desktop.
Save davidblewett/1d9ad0f09274ad4adf8d7b6c403622ac to your computer and use it in GitHub Desktop.
Tornado TCP Error
FROM python:3.7
RUN mkdir /app
COPY . /app
RUN apt-get update && \
apt-get install -y netcat && \
pip install Tornado
import ssl
import subprocess
import tornado.web
ssl_ctx = ssl.create_default_context()
ssl_ctx.check_hostname = False
app = tornado.web.Application()
app.listen(8888, ssl_options=ssl_ctx)
loop = tornado.ioloop.IOLoop.current()
loop.spawn_callback(subprocess.run, ['nc', '-vz', '127.0.0.1', '8888'])
loop.call_later(1, loop.stop)
loop.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment