3
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
4
# See LICENSE for details.
7
from twisted.internet.protocol import DatagramProtocol
8
from twisted.internet import reactor
10
class EchoClientDatagramProtocol(DatagramProtocol):
13
"What a fine day it is.",
17
def startProtocol(self):
18
self.transport.connect('127.0.0.1', 8000)
21
def sendDatagram(self):
23
datagram = self.strings.pop(0)
24
self.transport.write(datagram)
28
def datagramReceived(self, datagram, host):
29
print 'Datagram received: ', repr(datagram)
33
protocol = EchoClientDatagramProtocol()
34
t = reactor.listenUDP(0, protocol)
37
if __name__ == '__main__':