Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C Sockets
hey,
I am working on a udp client-server application where one server is supposed to handle 40 clients which could all be logged on at once as well...
Now in "unix" such issues are resolved by using "fork()" function which basically creates a child process to deal with the client and leaves the server to accept new connections...
I searched on the internet and found out that an exact analogous of "fork()" is not available in windows, however "CreateProcess()" could be used...
My previous research also introduced me to "thread pool" so now I've two questions:
1)Could I acheive the functionality of "fork()" by "CreateProcess()" in windows.
2)if this is possible,what should I do go for: threadpool or creating multiple processes ?
 
looking forward to the response...
Posted 18-Apr-13 0:44am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

(1) Both CreateProcess and fork creates a new process. However fork duplicates the calling process, while CreateProcess starts an executable. Both function allows the implementation of a multiprocess server.
 
(2) Usually such servers are multithreaded, however nothing prevents you to make it multiprocess instead.
Just be aware that inter-process communication is heavier.
  Permalink  
Comments
Aayman Khalid at 18-Apr-13 5:58am
   
So that means I should go for threadpool in order to save the processing power?
CPallini at 18-Apr-13 6:08am
   
You might. Have a look at this page: http://www.zerigo.com/article/apache_multi-threaded_vs_multi-process_pre-forked/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 200
2 Richard MacCutchan 135
3 DamithSL 95
4 Maciej Los 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100