<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=303553517-14052003>The following is 
your simpleserv.py echo server example.&nbsp; </SPAN></FONT><FONT face=Arial 
size=2><SPAN class=303553517-14052003>On a multihost (multiple ip addresses) 
server,&nbsp;</SPAN></FONT><FONT face=Arial size=2><SPAN 
class=303553517-14052003>how&nbsp;would I have it listen on a particular ip 
address?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=303553517-14052003><FONT face=Arial 
size=2>Thanks.</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><!--StartFragment -->&nbsp;<PRE>from twisted.internet import reactor, protocol


class Echo(protocol.Protocol):
    """This is just about the simplest possible protocol"""
    
    def dataReceived(self, data):
        "As soon as any data is received, write it back."
        self.transport.write(data)


def main():
    """This runs the protocol on port 8000"""
    factory = protocol.ServerFactory()
    factory.protocol = Echo
    reactor.listenTCP(8000,factory)
    reactor.run()

# this only runs if the module was *not* imported
if __name__ == '__main__':
    main()</PRE></DIV></BODY></HTML>