From b638c794614c92f784fa88022c5b10abcf355625 Mon Sep 17 00:00:00 2001 From: CodePanter Date: Thu, 28 Apr 2016 16:57:10 +0200 Subject: [PATCH] Prevented the 'SendDiscoveryPacket' from crashing. --- vloed.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vloed.py b/vloed.py index 1c9e74b..8f77f71 100755 --- a/vloed.py +++ b/vloed.py @@ -135,13 +135,17 @@ class Canvas(object): def SendDiscoveryPacket(self): """Lets send out our ip/port/resolution to any listening clients""" - self.broadcastsocket.sendto( - '%s:%f %s:%d %d*%d' % (PROTOCOL_PREAMBLE, PROTOCOL_VERSION, - UDP_IP, UDP_PORT, - self.width, self.height), - ('', DISCOVER_PORT)) - if self.debug: - print 'sending discovery packet' + try: + self.broadcastsocket.sendto( + '%s:%f %s:%d %d*%d' % (PROTOCOL_PREAMBLE, PROTOCOL_VERSION, + UDP_IP, UDP_PORT, + self.width, self.height), + ('', DISCOVER_PORT)) + if self.debug: + print 'sending discovery packet' + except Exception as error: + if self.debug: + print error def __del__(self): """Clean up any sockets we created"""