How to use fread from TCP/IP of a string?
Show older comments
Hello guys
I am trying to send a string from client to server using the fwrite command and while fread it in the server side I get the numeric values instead string inspite mentioning the char.
client = tcpip('172.26.44.34',30000,'NetworkRole','client')
fwrite(client,'SOURAV','char')
In Server Side
server = tcpip('0.0.0.0',30000,'NetworkRole','server')
fread(server,6,'char')
At the end inspite of getting the string "SOURAV", I get number as [83 79 85 82 65 86]. I donot know why the character is not showing?
Accepted Answer
More Answers (1)
Walter Roberson
on 15 Apr 2022
fread(server,6,'*char')
Or better yet in theory:
fread(server,6,'uint8=>char')
Categories
Find more on TCP/IP Communication in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!