PDA

View Full Version : Limiting World from running more than once.


Zafar
12-29-2002, 06:08 PM
I modified the world\net.cpp file to prevent more than once instance of world.exe from being loaded. This works fine under Win32, but under Linux it breaks compiles. I did this once for Linux, and a dozen times or so for Win32, but I cannot remember how to do it on Linux, and would like to implement it on both Win32 and Linux.

I added:
HANDLE hMutex = CreateMutex(NULL, FALSE, "EQEmuWorld");
if (hMutex)
{
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
cout << "EverQuest(TM) World Server Emulator is already running." << endl;
cout << "Please shutdown the existing copy, and reload." << endl;
exit (0);
}
}


right after:

int main(int argc, char** argv)
{



Adding this code for zone servers would be bad, as it would limit you to running only one zone -- so if you use this code, don't use it for zones; only the world server.

alkrun
01-02-2003, 04:41 PM
My question is why would you want to do this? I specifically wrote code to allow you to run multiple world servers on a box with multiple IP addresses. I'm not knocking your code, just that I don't see why you would limit people to one world server, maybe they want to run a production and a development world on the same server?