How to make communicate on raspberry pi over TCP/IP
Posted: Thu Mar 14, 2019 6:00 pm
Hi, I try to use flowcode8 to communicate over TCP/IP with TCP/IP raspberry pi function but I can't sent or receive data anything. could you give example for TCP/IP communication to me.
actually, I design flowchart in below and use 2 LED for check status when execute code.
https://drive.google.com/open?id=1LNAiT ... bANCjftGaa
Moreover, I just test by python with socket function from some web page. Then, I can make a communicate between my notebook and pi.
Client (my notebook ==>> IP : 192.168.2.99)
Server (raspberry pi3 B ==>> IP : 192.168.2.15)
from code client above, I try to use send some data to my note via LAN cable and use my notebook lookup something but it can't found.
Moreover, I would like to use function SendTo from TCPIP(Raspberry pi) reference in your manual on website but it didn't have on your product.
please update function on above and give me some example
Regard
actually, I design flowchart in below and use 2 LED for check status when execute code.
https://drive.google.com/open?id=1LNAiT ... bANCjftGaa
Moreover, I just test by python with socket function from some web page. Then, I can make a communicate between my notebook and pi.
Client (my notebook ==>> IP : 192.168.2.99)
Code: Select all
#!/usr/bin/python3
import socket
host = socket.gethostname()
port = 5052 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#s.connect((host, port))
s.connect(("192.168.2.15", port))
s.sendall(b'Hello')
data = s.recv(1024)
s.close()
print('Received', repr(data))
Server (raspberry pi3 B ==>> IP : 192.168.2.15)
Code: Select all
#!/usr/bin/python3
import socket
host = '192.168.2.15' # Symbolic name meaning all available interfaces
port = 5052 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
print (host , port)
s.listen(1)
conn, addr = s.accept()
print('Connected by', addr)
while True:
try:
data = conn.recv(1024)
if not data: break
print ("Client Says: "+str(data))
conn.sendall(b'Server Says:hi')
except socket.error:
print ("Error Occured.")
break
conn.close()
Moreover, I would like to use function SendTo from TCPIP(Raspberry pi) reference in your manual on website but it didn't have on your product.
please update function on above and give me some example
Regard