aboutsummaryrefslogtreecommitdiff
path: root/ParrotZik.py
diff options
context:
space:
mode:
authorDmitry Moiseev <m0sia@m0sia.ru>2013-11-07 14:32:58 +0600
committerDmitry Moiseev <m0sia@m0sia.ru>2013-11-07 14:32:58 +0600
commite56dacc4d3e15b4d82ea1553bd73af6221dfcc6c (patch)
treebb76afe34572f233d97e63201a86229341203d39 /ParrotZik.py
parentfe09ee5694030e465c29c60285ba9e86311423b4 (diff)
downloadpyParrotZikTCP-e56dacc4d3e15b4d82ea1553bd73af6221dfcc6c.tar.xz
pyParrotZikTCP-e56dacc4d3e15b4d82ea1553bd73af6221dfcc6c.zip
connection lost quick fix
Diffstat (limited to 'ParrotZik.py')
-rw-r--r--ParrotZik.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ParrotZik.py b/ParrotZik.py
index 2746259..05e316e 100644
--- a/ParrotZik.py
+++ b/ParrotZik.py
@@ -13,7 +13,8 @@ class ParrotZik(object):
if len(service_matches) == 0:
print "Couldn't find Parrot Zik"
- return False
+ self.sock = ''
+ return
first_match = service_matches[0]
port = first_match["port"]
@@ -86,7 +87,11 @@ class ParrotZik(object):
return self.sendMessage(message)
def sendMessage(self,message):
- self.sock.send(str(message))
+ try:
+ self.sock.send(str(message))
+ except:
+ self.sock = ''
+ return
data = self.sock.recv(7)
len = struct.unpack('B', data[1])[0]
data = self.sock.recv(1024)