aboutsummaryrefslogtreecommitdiff
path: root/backend/microservice/PythonServer/project/socket_example/socket2/client.py
blob: 65e76b55315603baee5b47b1e649b6bed3c77196 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()