Hey guys

I'm writing an HTTP server in Visual C++ 6.0 and I'm having some problems with running it as an NT service.

I've added the application to the service list via CreateService(), and I've also change main, ServiceMain and so on all around so it starts properly as a service and shuts down appropriately.

After setting the service status as running and so on I have a section that looks something like this:
Code:
	int SinSize = sizeof(struct sockaddr_in);		// Used later

	Beep(50, 1000);
	Beep(70, 1000);
	Beep(90, 1000);
	while (1)
	{
		Beep(90, 1000);
		// Accept a new connection
		/*SFD_New = accept(SFD_Listen, (struct sockaddr *) &ClientAddress, &SinSize);

		// Handle reuqest
		//CONNECTION * newRequest = new CONNECTION(SFD_New);
		send (SFD_New, "Content-type: text/html\n\nHello", 30, 0);
		Beep(100, 1000);
		//newRequest.HandleRequest();

		//delete newRequest;
		closesocket(SFD_New);*/
	}
   closesocket(SFD_Listen);
I have binded to the port and everything properly, but it shouldn't matter in this case as I've commented out the accept part.

When the service starts, I get the first 3 beeps from my system speaker, and then the beep from the loop. But thats all! In theory, the beep should continue because its in a never ending loop, yet it doesn't :S I have absolutely no idea why this is happening.

I can post all the code if necessary, but does anyone have any ideas why this is having problems?