summaryrefslogtreecommitdiff
path: root/Scripts/pythonSocket.py
diff options
context:
space:
mode:
authorjbjjbjjbj <julianteule@gmail.com>2017-01-13 20:02:01 +0100
committerjbjjbjjbj <julianteule@gmail.com>2017-01-13 20:02:01 +0100
commit70b65b88ac2119600b68e1a75e3053459d171764 (patch)
treec013223d81f30bdcdebe44ffe05bba30eb5cfb58 /Scripts/pythonSocket.py
parent9394dfc3c3e6cf07e6bdf08aaa663bc1063265e6 (diff)
Added new scripts
Diffstat (limited to 'Scripts/pythonSocket.py')
-rw-r--r--Scripts/pythonSocket.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Scripts/pythonSocket.py b/Scripts/pythonSocket.py
new file mode 100644
index 0000000..06c434b
--- /dev/null
+++ b/Scripts/pythonSocket.py
@@ -0,0 +1,23 @@
+import socket
+sock = socket.socket()
+
+server_addr = ('192.168.43.86', 5001)
+sock.bind(server_addr)
+
+sock.listen(1)
+print("Waiting for connection on " + str(server_addr))
+while True:
+ connection, client_address = sock.accept()
+ try:
+ print ('connection from', client_address)
+
+ # Receive the data in small chunks and retransmit it
+ while True:
+ data = connection.recv(16)
+ print('received ' ,data)
+ if not data:
+ print('no more data from', client_address)
+ break
+ finally:
+ # Clean up the connection
+ connection.close() \ No newline at end of file