Sunday 3 February 2019

TCP/IP Communication between Raspberry Pi and PC


TCP/IP Communication between Raspberry Pi and PC via Ethernet or WiFi:

Code:
import socket
TCP_IP = '111.93.42.81'
TCP_PORT = 10012
BUFFER_SIZE= 655350
file='test.txt'
f = open(file,'rb')
data=f.read(655350)
MESSAGE = "start" + data+ "end"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
s.close()
print "received data:"

0 comments:

Post a Comment

if you have any doubt please let me know