Skip to content

Commit

Permalink
Update server.py
Browse files Browse the repository at this point in the history
  • Loading branch information
richardanaya authored May 23, 2017
1 parent 7f64a56 commit e9437bc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import http.server
import socketserver

#set the process name to "chaos_server" so we can easily kill it with "pkill chaos_server"
def set_proc_name(newname):
from ctypes import cdll, byref, create_string_buffer
libc = cdll.LoadLibrary('libc.so.6')
buff = create_string_buffer(len(newname)+1)
buff.value = newname
libc.prctl(15, byref(buff), 0, 0, 0)
set_proc_name("chaos_server")

#start server on port 80
PORT = 80
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("", PORT), Handler)
Expand Down

0 comments on commit e9437bc

Please sign in to comment.