Membuat Socket Untuk Menjembatani antara Laptop dan Raspberry Pi

kali saya akan bereksperimen untuk membuat socket sebagai jalur komunikasi antara laptop thinkpad t420 dengan raspberry pi kali ini saya hanya ingin share codenya saja sedang ingin menyusun explanationnya hehehe
server.py

import socket

s = socket.socket()
host = '192.168.1.111' #ip of raspberry pi
port = 23232
s.bind((host, port))

s.listen(5)

def get_text(file):
   f=open(file)
   text =f.read()
   f.close()
   return text



while True:
  c, addr = s.accept()
  print ('Got connection from',addr)
  c.send('suhu cpu raspimu {}'.format(float(get_text('/sys/class/thermal/thermal_zone0/temp'))/1000))

client.py

import socket
s = socket.socket()
host = '192.168.1.111'# ip of raspberry pi
port = 23232
s.connect((host, port))
print(s.recv(1024))
s.close()

terimakasih guys udah mau baca blog unfaidah ini.