Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CAsyncSocket::Listen cannot be closed

3 views
Skip to first unread message

linuxfedora

unread,
Jan 4, 2010, 1:47:36 AM1/4/10
to
I have a problem that a MFC ActiveX program (Very simple) with just a
CAsyncSocket::Listen run.

I found that if the container is a C# program and it has Webbroswer
control and has loaded a ActiveX page, then the CAsyncSocket::Listen
cannot be closed.

How to repeat:

In the ActiveX Program, there is a function called:

SHORT CTestSocketCtrl::StartStandBy(SHORT port)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());

// TODO: Add your dispatch handler code here

return m_socket->StartListen(port);
}


int CMyAsyncSocket::StartListen(int port)
{
if(!Create(port))
{
DWORD dwError = GetLastError();
}
Listen();

return 0;
}

My C# program (WindowsApplication5) added the ActiveX and called
CTestSocketCtrl.StartStandBy(3000);
Now, i click a button to connect to a webpage with Java Applet
Then the socket is accpted a socket-> then i close the listening
socket with Close function->But it is still listening to the 3000
port.

If i don't connect to a webpage with Java Applet, it is okey without
problem.
Also, if i kill the java.exe created by my application, then the
socket will Close immediately.

You can download my full source code, it is just the related parts.
http://www.teleeye.com/marketing/Software/TestMFCSocket.zip

0 new messages