Skip to content

Commit abd0c11

Browse files
authored
Merge pull request #9 from GothamK/patch-2
Client to connect to the socket-server
2 parents 8c317c7 + d392f15 commit abd0c11

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/client-server/client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Client to connect to the socket-server
2+
3+
import socket
4+
5+
# Create a socket object
6+
s = socket.socket()
7+
8+
# Define the port on which you want to connect
9+
port = 12345
10+
11+
# connect to the server on local computer
12+
s.connect(('127.0.0.1', port))
13+
14+
# receive data from the server and decoding to get the string.
15+
print (s.recv(1024).decode())
16+
# close the connection
17+
s.close()

0 commit comments

Comments
 (0)