I am trying to build a robot that captures images from the RPi camera that is in installed, and try to sent it over to my Mac to do the image recognition and sent the result back. The robot was controlled by the Raspberry Pi 3 Model B. I have tried to communicate through socket but the whenever the it tries to connect, it always says “Connection refused” Any suggestions on new ways to communicate the RPi and the Mac wirelessly?
This is the code for the Server:
import socket
server = socket.socket()
server.bind(('127.0.0.1', 8000))
server.listen(0)
connection = server.accept()[0].makefile('wb')
print("success")
This is the code for the Client:
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 8000))
connection = client.makefile('rb')
print('connection sucessful')
Remember: I am just trying to make sure that the connection between the Raspberry Pi and the Mac is successful.