Click here to Skip to main content
15,916,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using Default Mail Program? Pin
Swinefeaster26-Sep-02 18:30
Swinefeaster26-Sep-02 18:30 
GeneralRe: Using Default Mail Program? Pin
Swinefeaster26-Sep-02 18:53
Swinefeaster26-Sep-02 18:53 
AnswerRe: Using Default Mail Program? Pin
Shog926-Sep-02 18:28
sitebuilderShog926-Sep-02 18:28 
GeneralRe: Using Default Mail Program? Pin
Swinefeaster26-Sep-02 18:30
Swinefeaster26-Sep-02 18:30 
GeneralRe: Using Default Mail Program? Pin
Swinefeaster26-Sep-02 18:53
Swinefeaster26-Sep-02 18:53 
Questionmay i read the same object on network from a file? Pin
imran_rafique26-Sep-02 16:03
imran_rafique26-Sep-02 16:03 
AnswerRe: may i read the same object on network from a file? Pin
jmkhael26-Sep-02 22:00
jmkhael26-Sep-02 22:00 
GeneralWSAAsyncSelect I/O & Multithreading :: Winsock Pin
valikac26-Sep-02 13:23
valikac26-Sep-02 13:23 
Hi.

I am working on a simple client-based winsock Windows program. The program works well under the current software design. However, I discovered a huge resource problem.

The program support multiple simultaneous connections. I use the WSAAsyncSelect() I/O model to handle I/O. Everything works well. I implemented two worker threads. One thread sends data. The second thread receives data. WSAAsyncSelect() sends messages via Windows queue and update the program on FD_WRITE, FD_READ, etc. Again, the program works as planned.

I discover a huge resource problem. The program takes up all CPU resource as it makes more and more socket connnections. In other works, the program stalls if the user attemps to makes ten or more connections. CPU usage is 100%.

I re-read Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund. If I am not mistaken, you do not need workers thread for winsock if you use a non-blocking I/O such as WSAAsyncSelect().

I would like to know if there is a flaw in the program design. My thought right now is that this design will not work because of the worker threads. There is no way Windows can handle too many worker threads. However, let say I implemented WSASend() and WSARecv() solutions directly in the primary thread (main applications), I believe that will lock up Windows or at least the program. For example, if I implement a while loop that calls WSARecv() until it returns 0, that will lock up the program. Is that right?

Thanks,
Kuphryn
GeneralRe: WSAAsyncSelect I/O & Multithreading :: Winsock Pin
jmkhael26-Sep-02 22:02
jmkhael26-Sep-02 22:02 
GeneralRe: WSAAsyncSelect I/O & Multithreading :: Winsock Pin
valikac26-Sep-02 22:33
valikac26-Sep-02 22:33 
GeneralRe: WSAAsyncSelect I/O & Multithreading :: Winsock Pin
Jon Hulatt26-Sep-02 22:44
Jon Hulatt26-Sep-02 22:44 
GeneralRe: WSAAsyncSelect I/O & Multithreading :: Winsock Pin
jmkhael26-Sep-02 22:46
jmkhael26-Sep-02 22:46 
GeneralRe: WSAAsyncSelect I/O & Multithreading :: Winsock Pin
Jon Hulatt26-Sep-02 22:50
Jon Hulatt26-Sep-02 22:50 
GeneralRe: WSAAsyncSelect I/O & Multithreading :: Winsock Pin
valikac27-Sep-02 5:14
valikac27-Sep-02 5:14 
GeneralDialog message question Pin
Anonymous26-Sep-02 11:33
Anonymous26-Sep-02 11:33 
GeneralRe: Dialog message question Pin
Shog926-Sep-02 12:06
sitebuilderShog926-Sep-02 12:06 
GeneralThe WM_SET_TEXT message Pin
Fiffismurf26-Sep-02 11:21
Fiffismurf26-Sep-02 11:21 
GeneralRe: The WM_SET_TEXT message Pin
RedZenBird26-Sep-02 11:23
RedZenBird26-Sep-02 11:23 
GeneralRe: The WM_SET_TEXT message Pin
Fiffismurf26-Sep-02 11:35
Fiffismurf26-Sep-02 11:35 
GeneralRe: The WM_SET_TEXT message Pin
Jon Hulatt26-Sep-02 22:54
Jon Hulatt26-Sep-02 22:54 
GeneralRe: The WM_SET_TEXT message Pin
Steve S27-Sep-02 0:30
Steve S27-Sep-02 0:30 
GeneralRe: The WM_SET_TEXT message Pin
Shog926-Sep-02 11:56
sitebuilderShog926-Sep-02 11:56 
GeneralRe: The WM_SET_TEXT message Pin
Fiffismurf27-Sep-02 7:13
Fiffismurf27-Sep-02 7:13 
QuestionCannot change transfer var? Pin
jimNLX26-Sep-02 11:07
jimNLX26-Sep-02 11:07 
AnswerRe: Cannot change transfer var? Pin
Gary R. Wheeler29-Sep-02 5:53
Gary R. Wheeler29-Sep-02 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.