~justin-fathomdb/nova/justinsb-openstack-api-volumes

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/core/examples/echoserv_udp.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
 
4
# See LICENSE for details.
 
5
 
 
6
from twisted.internet.protocol import DatagramProtocol
 
7
from twisted.internet import reactor
 
8
 
 
9
# Here's a UDP version of the simplest possible protocol
 
10
class EchoUDP(DatagramProtocol):
 
11
    def datagramReceived(self, datagram, address):
 
12
        self.transport.write(datagram, address)
 
13
 
 
14
def main():
 
15
    reactor.listenUDP(8000, EchoUDP())
 
16
    reactor.run()
 
17
 
 
18
if __name__ == '__main__':
 
19
    main()