11.2. WinSock

Microsoft Visual C++/Microsoft Foundation Classes


11.2. WinSock

11.2.1. I'm having problems with CSocket blocking, what's up?

I've worked around this by creating a dialog box that I pop up after calling Connect()... i.e.:

CMySocket MySocket;
MySocket.Create();
MySocket.Connect("mysmtphost",25);
DummyDlg DummyDialog;
MySocket.m_pDialog=&DummyDialog;
DummyDialog.DoModal();

This suspends the thread until MySocket sends a WM_CLOSE message to DummyDialog. I'd rather it look like:

MySocket.m_hEvent=CreateEvent(...);
WaitForSingleObject(MySocket.m_hEvent,INFINITE);

But that stops all processing of MySocket.

Cynthia Jennings ([email protected]), programmer.win32, 6/19/95