Skip to content

Instantly share code, notes, and snippets.

@thinkycx
Created August 30, 2017 07:48
Show Gist options
  • Save thinkycx/0b1d2619e80d99d8799b8a047adc77da to your computer and use it in GitHub Desktop.
Save thinkycx/0b1d2619e80d99d8799b8a047adc77da to your computer and use it in GitHub Desktop.
python ftp server
import SimpleHTTPServer
import SocketServer
import socket
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
ipList = socket.gethostbyname_ex(hostname)
PORT = 8001
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at %s:%s" % (str(ipList[2][3]),str(PORT))
httpd.serve_forever()
raw_input()
#python -m SimpleHTTPServer 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment