0
How to create two process
Hi Refer code I prepared for kind of chat messages https://code.sololearn.com/cxenKN8NI1x6 I need to create two different process for player 1 and player 2. Can anyone please guide me on this? I am very new to processes. Thanks in advance!
6 Answers
+ 2
True
In that case youlll need to fork a new process
https://www.delftstack.com/howto/cpp/cpp-fork/
+ 1
FYI
When you fork a new procees variables changed in one dont change the variables in the other.
They are two seprate processes after the fork. As if you ran the program on two terminals.
On the other hand threading stays in one process. And you have to keep in mind what variables each thread is manipulating.
+ 1
Im not sure but this video might help
https://youtu.be/W2Qu4RDk__k
And for your game id recommend doing socket programming with python
https://youtu.be/3QiPPX-KeSc
Example as to why
41:20-45:45
Keep in mind he is hardcooding the client messages
But you can have each client type in something before sending it
0
Spoke too soon :
Heres an example of threading working
https://code.sololearn.com/c3WW9t9hv4xB/?ref=app
0
Not sure but I don't think so...
Different threads does not mean different process... Right ? Is my understanding correct ?
Something to start new process is I never used..
Sometime , although less, but I do have used threads
0
Unfortunately I can't use fork as I am not on Linux... Any counterpart for windows ?