最近闲来无事,C++做了个微型基于进程池的计算服务器,纯socket编程。
项目地址
https://github.com/ZYunfeii/MyParallelComputingServer
项目思维导图
可以看看这个技术框架,具体功能说简单点就是远程计算逆矩阵,但是项目重点不在这个怎么求(事实上是拿Matlab生成的),重点在Linux Socket编程和多进程上。
使用
Basic Info
This is a concurrent computing server based on process pool, which is used to solve any order inverse matrix for clients in parallel.
Compile
Compile three projects separately.
cd Client
g++ -o client client.cpp
cd ProcessPoolServer
g++ -o process_pool_server process_pool_server.cpp
cd ComputingService/build
cmake ..
make
Use
Copy the binary “client” to the client machine.
Copy the binary “process_pool_server” and “ComputingSrv” to the client machine.
Make sure that the location of “ComputingSrv” is right. Otherwise, change the file_name in process_pool_server.cpp and then compile again.
Then you must make sure that server and client can “ping”:
Client machine:
ping serverIP
If it can “ping”, then do the following steps:
In server machine:
./process_pool_server IP Port
In client machine:
./client serverIP serverPort
|