You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Client-Application.py 550B

123456789101112131415
  1. import socket
  2. s = socket.socket() # instantiate
  3. host = socket.gethostname() # as both code is running on same pc
  4. port = 12345 # socket server port number
  5. s.connect((host, port)) # connect to the server
  6. message = input(" -> ") # take input
  7. while message.strip() != 'STOP':
  8. s.send(message.encode()) # send message
  9. data = s.recv(1024).decode() # receive response
  10. print('Received from server: ' + data) # show in terminal
  11. message = input(" -> ") # again take input
  12. s.close() # close the connection