Debian Codegraph @

docs/core/examples/echoserv_udp.py

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