need help running python script in linux

Ryan Paul segphault at sbcglobal.net
Mon May 17 05:09:56 EDT 2004


On Mon, 17 May 2004 01:02:17 -0700, xunil wrote:

> 
> #!/usr/bin/env python
> "USAGE: echoserver.py <port>"
> from SocketServer import BaseRequestHandler, TCPServer
> import sys, socket
> 
> class EchoHandler(BaseRequestHandler):
>     def handle(self):
>         print "Client connected:", self.client_address
>         self.request.sendall(self.request.recv(2**16))
>         self.request.close()
>         
>         if len(sys.argv) != 2:
>             print __doc__
>         else:
>             TCPServer(('',int(sys.argv[1])),
> EchoHandler).serve_forever()
>           

this defines a class, but you dont instantiate the class- so the code
essentially doesn't do anything. I suggest you read some tutorials.




More information about the Python-list mailing list