From 733e8203da1e58e2344f56d8dc8fed53d1ec3422 Mon Sep 17 00:00:00 2001 From: charlie Date: Sun, 20 Dec 2015 20:25:07 +0100 Subject: [PATCH] non-functional adapter python code pushed. --- a3/code/adapter/listener.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/a3/code/adapter/listener.py b/a3/code/adapter/listener.py index f6a0905..897ec4b 100644 --- a/a3/code/adapter/listener.py +++ b/a3/code/adapter/listener.py @@ -15,8 +15,9 @@ if __name__ == "__main__": print 'Listening on port {} for Gast'.format(GASTPORT) conn, addr = s.accept() print 'Connected by Gast at {}'.format(addr) + print 'Initiating connection to EchoServer at port {}...'.format(serverPort) sender = Sender(serverIP="127.0.0.1", networkInterface="lo", isLocal=True, serverPort=serverPort, waitTime=1, isVerbose=0) - seqnr = None + seqnr = 0 response = '' data = '' while True: @@ -39,6 +40,10 @@ if __name__ == "__main__": seqnr += 1 print 'A: {}'.format(seqnr) response = sender.sendInput('A', seqnr, sender.lastSeqReceived + 1) + elif data == 'DATA': + seqnr += 1 + print 'DAT: {} sending: a'.format(seqnr) + response = sender.sendInput('PA', seqnr, sender.lastSeqReceived + 1, 'a') elif data == 'RST': seqnr += 1 print 'RP: {}'.format(seqnr) -- 2.20.1