Merge branch 'master' of https://github.com/dopefishh/tt2015
authormart <mart@lubbe.rs>
Wed, 11 Nov 2015 08:58:35 +0000 (09:58 +0100)
committermart <mart@lubbe.rs>
Wed, 11 Nov 2015 08:58:35 +0000 (09:58 +0100)
Conflicts:
a2/1cases.tex

.gitignore
a2/1cases.tex
a2/code/client/helloworld.py [moved from a2/code/client/main.py with 56% similarity, mode: 0755]
a2/code/client/sn.txt [deleted file]
a2/code/setup/iptables.sh [new file with mode: 0755]
a2/tt2.tex

index 6d36477..ce15282 100644 (file)
@@ -48,3 +48,5 @@ C:\\nppdf32Log\\debuglog.txt
 
 # andere binaries
 *.odt
+*.pyc
+sn.txt
index 172ad03..18420a7 100644 (file)
@@ -1,5 +1,4 @@
 \subsection{Preflight checklist}
-
 Before actual certification is commenced we perform a manual test using a 
 checklist.
 If any of the checks fail we immediately reject the product.
old mode 100644 (file)
new mode 100755 (executable)
similarity index 56%
rename from a2/code/client/main.py
rename to a2/code/client/helloworld.py
index 6d109db..593252c
@@ -1,38 +1,26 @@
-from sender import Sender\r
-import sys\r
-\r
-# before running this program, be sure to run the TCPServer\r
-# also make sure to run the below command to prevent the OS from canceling our connection\r
-# sudo iptables -A OUTPUT -p tcp --tcp-flags PSH PSH -j ACCEPT\r
-# sudo iptables -A OUTPUT -p tcp --tcp-flags RST RST -j DROP\r
-\r
-# for running tests, you may need to store information on the received sequence number for the server\r
-# you can do that by defining new fields within the sender class/global variables to store such info\r
-\r
-# for non local communication, you can comment the raw sockets setting in sender.py (line 132)\r
-\r
-# run using sudo (!!!) from a command line terminal\r
-# and don't mind/ignore eclipse's red markings.\r
-\r
-if __name__ == "__main__":\r
-    serverPort = 10000\r
-    if len(sys.argv) > 1:\r
-        serverPort = int(sys.argv[1])\r
-    sender = Sender(serverIP="127.0.0.1", networkInterface="lo", isLocal=True, serverPort=serverPort, waitTime=1, isVerbose=1)\r
-    # isLocal is True if the interface is a local one\r
-    response = sender.sendInput("S", 100, 100) \r
-\r
-    # triggers the response SA _ 101 if the server is listening on the specified port\r
-    # if the server isn't listening, there are no responses\r
-    print sender.lastAckReceived\r
-    print sender.isTimeout\r
-    \r
-    # an example for the echo handling server\r
-    if sender.isTimeout == False: # in case something was received\r
-        sender.sendInput("A", 101, sender.lastSeqReceived + 1) # connection is established\r
-        sender.sendInput("A", 101, sender.lastSeqReceived + 1, data = "C") # send some data\r
-        sender.sendInput("A", 102, sender.lastSeqReceived + 1, data = "C") # send some data\r
-        sender.sendInput("FA", 103, sender.lastSeqReceived + 1) # close connection (the echo also closes)\r
-        sender.sendInput("RP", 104, 0) # reset connection\r
-    \r
-    sender.sendReset() # switch sender port\r
+#!/usr/bin/python
+from sender import Sender
+import sys
+
+if __name__ == "__main__":
+    serverPort = 10000
+    if len(sys.argv) > 1:
+        serverPort = int(sys.argv[1])
+    sender = Sender(serverIP="127.0.0.1", networkInterface="lo", isLocal=True, serverPort=serverPort, waitTime=1, isVerbose=1)
+    # isLocal is True if the interface is a local one
+    response = sender.sendInput("S", 100, 100) 
+
+    # triggers the response SA _ 101 if the server is listening on the specified port
+    # if the server isn't listening, there are no responses
+    print sender.lastAckReceived
+    print sender.isTimeout
+    
+    # an example for the echo handling server
+    if sender.isTimeout == False: # in case something was received
+        sender.sendInput("A", 101, sender.lastSeqReceived + 1) # connection is established
+        sender.sendInput("A", 101, sender.lastSeqReceived + 1, data = "Hello world!") # send some data
+        sender.sendInput("FA", 103, sender.lastSeqReceived + 1) # close connection (the echo also closes)
+        sender.sendInput("RP", 104, 0) # reset connection
+    
+    sender.sendReset() # switch sender port
+    print 'Succes!'
diff --git a/a2/code/client/sn.txt b/a2/code/client/sn.txt
deleted file mode 100644 (file)
index 05f3e49..0000000
+++ /dev/null
@@ -1 +0,0 @@
-20233
\ No newline at end of file
diff --git a/a2/code/setup/iptables.sh b/a2/code/setup/iptables.sh
new file mode 100755 (executable)
index 0000000..6006919
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+iptables -A OUTPUT -p tcp --tcp-flags PSH PSH -j ACCEPT
+iptables -A OUTPUT -p tcp --tcp-flags RST RST -j DROP
index df1f479..0ffb82d 100644 (file)
@@ -10,7 +10,6 @@
 \section{Results}
 \input{2results.tex}
 
-\newpage
 \nocite{*} %% weghalen bij daadwerkelijke cite
 \bibliographystyle{plain}
 \bibliography{tt2}