aboutsummaryrefslogtreecommitdiff
path: root/backend/microservice/PythonServer/project/api/socket2/client.py
diff options
context:
space:
mode:
authorNevena Bojovic <nenabojov@gmail.com>2022-03-15 23:10:12 +0100
committerNevena Bojovic <nenabojov@gmail.com>2022-03-15 23:10:12 +0100
commit39228ed08db5aa56e6a1c02ddbfc6691e1d0eef0 (patch)
treef835e606fc0ee2b50c4b7f9d05e065ee94dc91e9 /backend/microservice/PythonServer/project/api/socket2/client.py
parent72005d90ce26890be13baec2435b2bf536165168 (diff)
Druga verzija - Python socket.
Diffstat (limited to 'backend/microservice/PythonServer/project/api/socket2/client.py')
-rw-r--r--backend/microservice/PythonServer/project/api/socket2/client.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/microservice/PythonServer/project/api/socket2/client.py b/backend/microservice/PythonServer/project/api/socket2/client.py
new file mode 100644
index 00000000..65e76b55
--- /dev/null
+++ b/backend/microservice/PythonServer/project/api/socket2/client.py
@@ -0,0 +1,16 @@
+# Import socket module
+import socket
+
+# Create a socket object
+s = socket.socket()
+
+# Define the port on which you want to connect
+port = 12345
+
+# connect to the server on local computer
+s.connect(('127.0.0.1', port))
+
+# receive data from the server and decoding to get the string.
+print (s.recv(1024).decode())
+# close the connection
+s.close() \ No newline at end of file