How to use 'webserverone' in Python

Every line of 'webserverone' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
42def webServer(ip,port):
43 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
44 s.bind((ip, int(port)))
45 s.listen(8)
46
47 conn,addr=s.accept()
48 print addr
49 data=conn.recv(4096)
50 print data
51
52
53 h = "HTTP/1.0 200 OK\r\n"
54 c = "%sContent-Type: text/html\r\n\r\n"
55 html = "hello world"
56 res = h + c + html
57 conn.send(res)
58
59 sleepSecond(3)
60 conn.close()
61 s.close()
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets