Click here to Skip to main content
16,011,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Crash at customized button Pin
Emilio Garavaglia3-Sep-08 22:06
Emilio Garavaglia3-Sep-08 22:06 
GeneralRe: Crash at customized button Pin
kDevloper3-Sep-08 22:30
kDevloper3-Sep-08 22:30 
GeneralRe: Crash at customized button PinPopular
SandipG 3-Sep-08 22:09
SandipG 3-Sep-08 22:09 
GeneralRe: Crash at customized button Pin
Naveen3-Sep-08 22:17
Naveen3-Sep-08 22:17 
GeneralRe: Crash at customized button PinPopular
toxcct3-Sep-08 23:00
toxcct3-Sep-08 23:00 
QuestionNot able to connect to database when logging as as Standard User (Non- Administrative user) in Vista Pin
V K 23-Sep-08 20:33
V K 23-Sep-08 20:33 
QuestionCSocket threading issue Pin
tony_Udz3-Sep-08 20:32
tony_Udz3-Sep-08 20:32 
AnswerRe: CSocket threading issue [modified] Pin
SandipG 3-Sep-08 21:04
SandipG 3-Sep-08 21:04 
tony_udz wrote:
while (1)
{
CSocket sockRecv;
sockSrvr.Accept(sockRecv);
AfxBeginThread(ThreadProc, &sockRecv);
Sleep(5000);
}


I think problem is you are creating sockRecv on stack.
As soon as you create the thread it will go out of scope and destructor will be called and connection will close. Try this

CSocket *sockRecv = new CSocket();

dont forget to delete the socket in the thread after the operations are complete.
I hope it helps.


I did not know that we can not use the worker thread with the CSocket
See Roger's Reply Smile | :)

Regards,
Sandip.

modified on Thursday, September 4, 2008 4:56 AM

AnswerRe: CSocket threading issue Pin
Roger Stoltz3-Sep-08 22:25
Roger Stoltz3-Sep-08 22:25 
GeneralRe: CSocket threading issue Pin
SandipG 3-Sep-08 23:00
SandipG 3-Sep-08 23:00 
GeneralRe: CSocket threading issue Pin
Roger Stoltz3-Sep-08 23:04
Roger Stoltz3-Sep-08 23:04 
GeneralRe: CSocket threading issue Pin
tony_Udz4-Sep-08 1:43
tony_Udz4-Sep-08 1:43 
Questionsetup package creation Pin
AnithaSubramani3-Sep-08 20:30
AnithaSubramani3-Sep-08 20:30 
AnswerRe: setup package creation Pin
Cedric Moonen3-Sep-08 20:38
Cedric Moonen3-Sep-08 20:38 
GeneralRe: setup package creation Pin
AnithaSubramani3-Sep-08 20:41
AnithaSubramani3-Sep-08 20:41 
GeneralRe: setup package creation Pin
Rajesh R Subramanian3-Sep-08 20:49
professionalRajesh R Subramanian3-Sep-08 20:49 
GeneralRe: setup package creation Pin
AnithaSubramani3-Sep-08 20:58
AnithaSubramani3-Sep-08 20:58 
Questionproblem in connection to serial port Pin
manju23reddy3-Sep-08 20:07
manju23reddy3-Sep-08 20:07 
AnswerRe: problem in connection to serial port Pin
Cedric Moonen3-Sep-08 20:26
Cedric Moonen3-Sep-08 20:26 
GeneralRe: problem in connection to serial port Pin
manju23reddy3-Sep-08 21:28
manju23reddy3-Sep-08 21:28 
GeneralRe: problem in connection to serial port Pin
Cedric Moonen3-Sep-08 21:37
Cedric Moonen3-Sep-08 21:37 
GeneralRe: problem in connection to serial port Pin
manju23reddy3-Sep-08 21:50
manju23reddy3-Sep-08 21:50 
QuestionCOM type name Pin
George_George3-Sep-08 19:58
George_George3-Sep-08 19:58 
QuestionStatic text as a link. Pin
Le@rner3-Sep-08 19:57
Le@rner3-Sep-08 19:57 
AnswerRe: Static text as a link. Pin
_AnsHUMAN_ 3-Sep-08 20:04
_AnsHUMAN_ 3-Sep-08 20:04 

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.