To start working with the library you have to initialize it.
There are two ways of doing so:
Initialize it, and supply a message loop in the main thread. (like an MFC or GUI application).
Initialize it while knowing there is no message loop in the main thread. (Then the library will create its own message loop)
Initializing and supplying a message loop
In class CSpoofBase there's a method: InitializeSockets, that expects two parameters:
|
BOOL bMultiThreaded |
Default is TRUE, which means the socket engine will be multithreaded, the only reason to set it to FALSE is if you are using blocking sockets. |
|
unsigned long ulNumberOfThreads |
Default is 10, which means the engine will spawn 10 threads for the sockets. (see socket management to understand how the threads affect the sockets) |
If you work in an MFC/GUI application you have a message loop already, if not you can write one, or use some of our supplied message loops. (in class CAsyncSocket, there are couple of static methods which implements the message loop: SimpleMessageMap, SimpleMessageMapKey)
Initializing without supplying a message loop
In class CSpoofBase there's a method: InitializeSocketsNoMap, that expects the same parameters as InitializeSockets.
This method spawns another thread to be the message loop.