TCP IP communication b/w two systems
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I try to implement the TCPIP algorithm between two sysstems. I couldn't slove the following problems:
- The data is transferred in fwrite is by default 'uint8' and this is making any value >=256 as 255 in the receiver side.
- If I use the precision as per the documentation suggested in the MALTAB like 'double' or 'integer*8' or 'uint64', I keep on getting different errors as Precision not supported or Sync/Async related error.
- Since the data size could be different in each of our iteration (for loop condition), I transfered the length of the data first and then the original data in two different sends and two different receives. I found that sometime sender side is working very fast showing that the data has been sent for several entries of i without being shown in the side of reciever and sometimes even while the data was not being sent, reciver side was continuously getting the data.
- Even one time the first send of the length of the signal got appended with the second send of the original signal and that's a new issue we would not want to see.
I have shared my latest code.
0 comentarios
Respuestas (1)
Walter Roberson
el 27 de Jul. de 2019
For transmission, typecast() all data to uint8(). This would produce a vector of uint8 values for each item; concatenate all of those together into a uint8 vector.
For reception, index into the vector to break the vector at appropriate places, and typecast() back to the type you know the value should be.
It is a good idea to prefix the data with the length of the data, and you can do that as part of the uint8 vector; you do not need a separate packet for it.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!