The first time this code is called during the execution, the ID is sent successfully. The second time the program returns a debug error when the "bRetVal = client->OpenConnection("localhost",6000);" statement is called. During doing some debugging and one the second call of the former statement - ie when a second connection was requested, i was pointed to the followed code part of "wincore.cpp" by the debugger, if it is any help:

Often if a method succeeds on the first call, but fails on the next call, it is due to uninitialised variables. In debug mode many IDEs set the variables to 0/NULL. In release mode this does not happen.

Code:

char szBuf[256]={0};//set to empty

Not enough code posted to make any better guess.....

Could be some memory failure/over-run in your CNDKMessage class. It could be an error with your globals etc.

Why send in an ID number and then use two diff globals?

Is the IDE reporting any exceptions/access violations?

"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche

"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best