Hey, I'm doing sockets programming. Pretty much new to it.
The application is a Windows Service, in its ServiceMain() function I call CAsyncSocket's Listen() method, to listen for client connections. But after it starts listening for connections, it'll return and the ServiceMain() function will return and the service is stopped.
What I want to do with this is that, wait until a specific event occurs say WM_QUIT, till than listen for connections. How to do it?
// static member function (callback)
void CNTService::ServiceMain(DWORD dwArgc, LPTSTR* lpszArgv)
{
// m_Server containts two sockets
// one for listening and one for accepting connections
m_Server.StartListening(); // calls Listen method on the listener socket
// it will return and service will quit
// which I don't want
}
I'm okay with mixing Win32 and MFC, so if it can be done in Win32 please do tell me too :)