Wrong and Excessive values are received by the Host Server MATLAB while communicating Via TCP/IP Server Socket with Client Server MATLAB installed at different computer.
Mostrar comentarios más antiguos
I was trying to transfer data via TCP/IP Server Socket communication between two different version of MATLAB installed in two different computers. The Server computer has MATLAB version 2016a installed and the Client server has MATLAB 2021a installed in it.
The code for MATLAB (R2016a) Host Server is as follows:
server = tcpip('0.0.0.0', 10000, 'NetworkRole', 'server')
fopen(server)
The code for MATLAB (R2021a) Client Server is as follows:
client = tcpclient("172.26.45.99",10000)
client =
tcpclient with properties
Address: '172.26.45.99'
Port: 10000
NumBytesAvailable: 0
Show all properties, functions
data = [1 2 3 4 5];
write(client,data)
The code for MATLAB (R2016a) Host Server is as follows:
read_data = fread(server,server.BytesAvailable)
After running this code in host server machine the variable size "read_data" becomes 40 x 1 double instead of 5 x 1. The values received were attached with this mail. I donot have any clue why values are comming as wrong and to excessive. Can anyone guide me why such abnormal data is receiving by the host server?

Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre TCP/IP Communication en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!