final hello
authormart & charlie <tt1516@ru.nl>
Sun, 20 Dec 2015 20:18:37 +0000 (15:18 -0500)
committermart & charlie <tt1516@ru.nl>
Sun, 20 Dec 2015 20:18:37 +0000 (15:18 -0500)
a3/code/jtorx/client/helloworld.py

index 3578d3e..e729e4b 100644 (file)
@@ -48,14 +48,16 @@ if __name__ == "__main__":
             response = sender.sendInput("RP", seqnr, 0)
             sender.sendReset()
         if data == 'DAT?':
-            seqnr += 1
             print 'DAT: {} sending: a'.format(seqnr)
-            response = sender.sendInput('PA', seqnr, sender.lastSeqReceived + 1, 'a')
+            response = sender.sendInput('A', seqnr, sender.lastSeqReceived + 1)
+            response = sender.sendInput('PA', seqnr, sender.lastSeqReceived + 1, data='a\n')
+            seqnr += 2
         if response:
+            print 'response: {}'.format(response)
             if response == 'Timeout':
                 print 'data: {} - TIMEOUT!'.format(data)
                 conn.send('TIMEOUT!\n')
-            elif response[0] == 'A':
+            elif response[0] == 'A' or response[0] == 'PA':
                 print 'data: {} - ACK!'.format(data)
                 conn.send('ACK!\n')
             elif response[0] == 'R':