From: mart & charlie Date: Sun, 20 Dec 2015 20:18:37 +0000 (-0500) Subject: final hello X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=51f0136c62497acc658e1d1943cbad930208a663;p=tt2015.git final hello --- diff --git a/a3/code/jtorx/client/helloworld.py b/a3/code/jtorx/client/helloworld.py index 3578d3e..e729e4b 100644 --- a/a3/code/jtorx/client/helloworld.py +++ b/a3/code/jtorx/client/helloworld.py @@ -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':