简体   繁体   中英

send file content with a message queue C

I'm looking for the best way to read a file and send the contents via a message queue. I tried to read the file line by line and insert the contents of the file into an array, but maybe not the best way. I was wondering is there another way, perhaps it's better to send the whole file and then read it to the process that receives it. Do you have any suggestions? thanks in advance.

As I read it there is hardly a difference between the per line array send method and the full file send method. You are only spreading the load on the network that way. Unless the receiving party has a limited CPU and memory cache it does not increase the overall system performance.

I would suggest looking into parsing the whole file for relevant data. Then send this new data via a message queue. Unless of course the program reading the file has limited resources, while the receiving end has enough resources and the traffic load on the network isn't an issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM