From 35444e483048f6ebeac4bbd3198862e0703d5304 Mon Sep 17 00:00:00 2001 From: charlie Date: Mon, 25 Jan 2016 13:51:01 +0100 Subject: [PATCH] shizzle iets aangepast --- a4/tcp/adapter/listener.py | 17 +++++++++++++++-- a4/tcp/run.sh | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/a4/tcp/adapter/listener.py b/a4/tcp/adapter/listener.py index d64503b..a6d8999 100644 --- a/a4/tcp/adapter/listener.py +++ b/a4/tcp/adapter/listener.py @@ -20,6 +20,8 @@ if __name__ == "__main__": seqnr = 0 response = '' data = '' + has_error=False + did_syn=False while True: print 'waiting for data' done = False @@ -34,14 +36,25 @@ if __name__ == "__main__": print 'received: {}'.format(data) if data == 'RES': print 'resetting the SUT...' - #sender.sendReset() + sender.sendReset() sender = Sender(serverIP="127.0.0.1", networkInterface="lo", isLocal=True, serverPort=serverPort, waitTime=1, isVerbose=0) data = '' + has_error = False + did_syn = False continue - elif data == 'SYN': + elif has_error: + response = 'ERR' + elif data == 'SYN' and not did_syn: seqnr = 100 print 'S: {}'.format(seqnr) response = sender.sendInput('S', seqnr, seqnr) + did_syn = True + elif not did_syn: + response = 'ERR' + has_error = True + elif data == 'SYN': + response = 'ERR' + has_error = True elif data == 'ACK': response = 'Timeout' if sender.lastSeqReceived != None: diff --git a/a4/tcp/run.sh b/a4/tcp/run.sh index 645b4f8..cbda43f 100755 --- a/a4/tcp/run.sh +++ b/a4/tcp/run.sh @@ -1,3 +1,3 @@ #!/bin/bash -x #java -cp ":lib/automata-parent.jar:lib/learnlib-parent.jar" learner.Main small -java -cp ":lib/automata-parent.jar:lib/learnlib-parent.jar" learner.Main partial LStar rand +java -cp ":lib/automata-parent.jar:lib/learnlib-parent.jar" learner.Main partial TTT wm -- 2.20.1