non-functional adapter python code pushed.
authorcharlie <somemail@something.com>
Sun, 20 Dec 2015 19:25:07 +0000 (20:25 +0100)
committercharlie <somemail@something.com>
Sun, 20 Dec 2015 19:25:07 +0000 (20:25 +0100)
a3/code/adapter/listener.py

index f6a0905..897ec4b 100644 (file)
@@ -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)