开发者

how server can save a file which has been sent by a client?

开发者 https://www.devze.com 2023-02-03 03:35 出处:网络
I am writing a client-server in C in which many clients send a running file to server and server needs to execute the 开发者_开发技巧file and save the result in their computer.

I am writing a client-server in C in which many clients send a running file to server and server needs to execute the 开发者_开发技巧file and save the result in their computer. now I have 2 questions: 1-should server save the receiving file before executing it?if yes how? 2-I am going to use CreateProcess() function to make a child and run every clients file in different process..is that a good choice?!

thank you for your kind help in advance Negar


1.) Yes. And if you are asking this, you probably doesn't have the knowledge to run executables in-memory.

2.) CreateProcess() enable the host (your server app) to share handle with the child (spawned app). This is helpful if you want to know the child's console output.


1) Yes, probably a good Idea if want to build some resilience in your server at later point.

2) Yes again, apart from the reasons outlined by YeenFei for security and robustness perspective. As the executable received from the client might crash and you do not want your server process to crash along with it.

0

精彩评论

暂无评论...
验证码 换一张
取 消