树莓派TCP通信
#https://blog.csdn.net/qq_41204464/article/details/83446394
import socket
import time
HOST = ‘192.168.43.242‘
PORT = 8266
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind((HOST, PORT))
sock.listen(5)
while True:
connection,address = sock.accept()
print (‘IP Address:‘+ str(address))
try:
connection.settimeout(10)
buf = connection.recv(1024)
print(buf)
except socket.timeout:
print (‘time out‘)
connection.close() 相关推荐
LeeHDsniper 2020-11-05
wanshiyingg 2020-09-29
andonliu 2020-09-03
嵌入式开发爱好者 2020-08-28
lu00kill 2020-08-17
tianyayi 2020-08-16
LIEVEZ 2020-08-09
ohhardtoname 2020-07-25
LeeHDsniper 2020-07-19
shenxiuwen 2020-07-16
wzxxtt0 2020-06-25
mattraynor 2020-06-25
咏月东南 2020-06-10
wangz 2020-06-03
wanxuncpx 2020-06-01
LIEVEZ 2020-05-30