summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-06-16 02:27:33 (GMT)
committerGuido van Rossum <guido@python.org>1998-06-16 02:27:33 (GMT)
commit32490824b6d5765a72662229d46e48ee34377b2f (patch)
tree54f5ab234c7d0261fd999c87a8d00c004eb5ad40 /Lib
parent76ec53c64df498eebc08d5cf7e53d2fc01064384 (diff)
downloadcpython-32490824b6d5765a72662229d46e48ee34377b2f.zip
cpython-32490824b6d5765a72662229d46e48ee34377b2f.tar.gz
cpython-32490824b6d5765a72662229d46e48ee34377b2f.tar.bz2
Fixed the UDP server -- this never worked. Ray Loyzaga deserves
credit for complaining about this and for testing these changes.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/SocketServer.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index cf8a365..0d0caac 100644
--- a/Lib/SocketServer.py
+++ b/Lib/SocketServer.py
@@ -265,7 +265,12 @@ class UDPServer(TCPServer):
max_packet_size = 8192
def get_request(self):
- return self.socket.recvfrom(self.max_packet_size)
+ data, client_addr = self.socket.recvfrom(self.max_packet_size)
+ return (data, self.socket), client_addr
+
+ def server_activate(self):
+ # No need to call listen() for UDP.
+ pass
if hasattr(socket, 'AF_UNIX'):
@@ -411,4 +416,4 @@ class DatagramRequestHandler(BaseRequestHandler):
self.wfile = StringIO.StringIO(self.packet)
def finish(self):
- self.socket.send(self.wfile.getvalue())
+ self.socket.sendto(self.wfile.getvalue(), self.client_address)