Hi there,

I am a newbie to python.
I am experimenting with sockets.
nothing happens when i execute the following script.
basically the script is supposed to detect incoming connections.

Your help is much appreciated,

Jer

##############################################################3
#!python


from socket import *

class webserver:

 def __init__(self,port,wwwroot):
  self.PORT = port
  self.WWWROOT = wwwroot

 def start(self):
  ss = socket(AF_INET,SOCK_STREAM)
  ss.bind("127.0.0.1",self.PORT)
   ss.setblocking(0)
   ss.listen(1)
  handle(ss)


 def checkForConn(ss):
  try:
   addr = ss.accept
  except:
   return None
  print "connection from",addr
  return addr

 def handle(ss):
  while not Done:
   if checkForConn(ss):
    print "hit\n"
    Done = 1


if __name__ == "__main__":
 server = webserver('80','/')
 server.start



_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to