# This is the network connection handler for AKOS
# to start it type: python akos.py
# python interpreter can be found at: http://www.python.org
# This should run on any platform python has been ported to
#
# - Patrick Wendorf (aka. Beholder) 

from socket import *

#Open a socket for each connection on port 4000
sock = socket(AF_INET, SOCK_STREAM)
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
sock.bind('', 32377)
sock.listen(1)
sock.setblocking(0)

#infinite Loop to handle connections, and do server processing ;)
a = 1

while(a==1):
	try:
		connection, address = sock.accept()
		print connection
		print address
		connection.send("Sorry AKOS is not available\r\n")
		connection.close()
	except: pass

