I found a UDP Receive block in Simulink. It requires the other end of the communication, which is vizard, to specify the port that receives data. I'm not sure how to do it. I think my code only specifies the port that sends data. Am I missing something?
Code:
import viz
viz.go()
import socket
COMPUTER_IP_ADDRESS = socket.gethostbyname('192.59.88.91')
PORT = 25000 #The port to send data on
OutSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
OutSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def SendData(data):
OutSocket.sendto(data,(COMPUTER_IP_ADDRESS,PORT))
vizact.onkeydown(' ',SendData,'hello there')
Thanks!