# The Event Manager

The Event Manager defines any event manager to be used by libwww for handling events. An event is not strictly defined as it is highly platform dependent and hence out of scope for the Library. If you are using the libwww pseudo threads on Unix then an event is when the select() system call returns a notification on a socket descriptor, but it may as well be an asynchronous event from the windows manager etc. If your application is not using anything but traditional blocking sockets then you do not need an event manager at all. In that case, libwww will block on any socket or system call until the process can proceed.

The libwww interface to an event manager is very simple as it consists of registering a socket descriptor, the location in the program, and the current state when an operation (for example `read`) would block. When the event manager at a later point in time gets a notification that the socket has become ready, it can then call libwww with the state saved from the registration and libwww can continue. Second, libwww must be able to unregister a socket when it is not anymore in a state where it can block. Only in case the application wishes to use non-blocking sockets it should register methods for handling the registration process as described below.

Note: The library core does not define any event manager - it is considered part of the application. The library comes with a default event manager which can be initiated using the function `HTEventInit()` in HTInit module

If you are working on a MSWindows platform then you have the possibility of using asynchronous socket management (proactive mode) instead of typical Unix select based I/O (reactive mode). Please read the Windows documentation for more details.

Registrering an Event Manager