diff options
Diffstat (limited to 'backend/microservice/PythonServer/project/socket_example/socket2/client.py')
-rw-r--r-- | backend/microservice/PythonServer/project/socket_example/socket2/client.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/microservice/PythonServer/project/socket_example/socket2/client.py b/backend/microservice/PythonServer/project/socket_example/socket2/client.py new file mode 100644 index 00000000..65e76b55 --- /dev/null +++ b/backend/microservice/PythonServer/project/socket_example/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 |