Hi!

I have an iPAQ 3600 with PocketPC 2000, and I want to
write a server application that accepts incoming
connections using the CCeSocket class.

I know that I have to derive from that class and override
the OnAccept method and so on, but try the following code:

CCeSocket *mySock;
mySock = new CCeSocket( CCeSocket::FOR_LISTENING );
mySock->Create();
delete mySock;

Everything is fine as long as I don't delete my object, then system
pauses. I see such code in the destructor:


code:------------------------------------------------------
--------------------------~CCeSocket()
{
//...

if (m_pListenThread)
{
while (::GetExitCodeThread (m_pListenThread->m_hThread,
&dwCode) )
{
if (dwCode == STILL_ACTIVE)
{
Sleep(50);
}
}
gCeSocketCS.Lock();
delete m_pListenThread;
m_pListenThread = 0;
gCeSocketCS.Unlock();
}
}
-----------------------------------------------------------
---------------------

it means, that if ListenThread returns 0 (normal exit),
then while-cycle never ends. I think they just
forgotten "else break;" as in the code of CCeSocket (FOR_DATA), in
fact the problem nto exist if the CCeSocket is created (FOR_DATA)!

how to solve this problem? Can i modify MFC source file and so
MFC300.dll? How?

Thank you,

Antonio

Re: Bug in destructor of CCeSocket class by jacki

jacki
Fri Nov 14 01:48:47 CST 2003

It seems not a bug at all. The WHILE loop wait for the normal exit of
ListenThread and after ListenThread exited loop body should be neglect.
"Antonio" <d_erricoantonio@hotmail.com>
??????:e6564a58.0310281127.1a9b95a9@posting.google.com...
> Hi!
>
> I have an iPAQ 3600 with PocketPC 2000, and I want to
> write a server application that accepts incoming
> connections using the CCeSocket class.
>
> I know that I have to derive from that class and override
> the OnAccept method and so on, but try the following code:
>
> CCeSocket *mySock;
> mySock = new CCeSocket( CCeSocket::FOR_LISTENING );
> mySock->Create();
> delete mySock;
>
> Everything is fine as long as I don't delete my object, then system
> pauses. I see such code in the destructor:
>
>
> code:------------------------------------------------------
> --------------------------~CCeSocket()
> {
> //...
>
> if (m_pListenThread)
> {
> while (::GetExitCodeThread (m_pListenThread->m_hThread,
> &dwCode) )
> {
> if (dwCode == STILL_ACTIVE)
> {
> Sleep(50);
> }
> }
> gCeSocketCS.Lock();
> delete m_pListenThread;
> m_pListenThread = 0;
> gCeSocketCS.Unlock();
> }
> }
> -----------------------------------------------------------
> ---------------------
>
> it means, that if ListenThread returns 0 (normal exit),
> then while-cycle never ends. I think they just
> forgotten "else break;" as in the code of CCeSocket (FOR_DATA), in
> fact the problem nto exist if the CCeSocket is created (FOR_DATA)!
>
> how to solve this problem? Can i modify MFC source file and so
> MFC300.dll? How?
>
> Thank you,
>
> Antonio