Initial import to Tizen
[profile/ivi/python-twisted.git] / doc / core / examples / echoserv_udp.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 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()