URL server DLL

From Komodia
Jump to: navigation, search

The DLL is used only if you don't plan to use Komodia's Redirector and want to interface with the URL server directly.

Sample

The DLL comes with a C++ sample that shows how to integrate with it and query the classification of a page.

Contents

The sample contains the following files:

  • KomodiaClassificationDLL.dll - DLL that communicates with the server.
  • TestClassificationDLL.exe - Applications that shows how to use the DLL.
  • TestClassificationDLL (directory) - Source code of the application.

Latency optimizations

There are two ways to use the DLL query function:

void __stdcall GetClassificationDLL(const char* pURL,
				    DWORD dwTimeout,
				    bool bCacheOnly,
				    char* pResult,
				    DWORD dwResultSize)

With timeouts

The function will only exit when there's a result, or the timeout occured.

Without timeout

On the first call you supply a time of 0, if the result is not cached, the function will generate a request and exit immediately, you can later call the function again and if the answer arrived, you will get the result.

The time it takes to get a result depends on your proximity to the server, it will usually take between 10-500ms for a reply when the site is known, when the site is new, reply can take up to five seconds (during that time the real time scanner determines the site category)

For example you would query the site as soon as a request is made, if the data exists you get it immediately, if not, you should hold the data you receive and query again for the response, this way you will not wait if you would put the timeout during the request phase.

Threading concurrency

The DLL is thread safe, you can call it from any thread without a need for a mutex.

DLL cache

The DLL manages an internal cache of data so you don't need to cache the results.

Protocol

The DLL implements both the HTTP and the binary protocol, it will first try the binary protocol but will fallback to HTTP if there's a blocking firewall.