My Project
|
Option names. More...
#include <NPLNetClient.h>
Public Member Functions | |
virtual INPLWebService * | GetWebService (const char *sURL) |
get the web service interface by its URL, if the web service does not exists it will return NULL, in which case one needs to call OpenWebService() | |
virtual INPLWebService * | OpenWebService (const char *sURL, const char *sUserName, const char *sPassword, const char *sDomain) |
open a new web service with optional credentials More... | |
virtual bool | CloseWebService (const char *sURL) |
close a given web service. More... | |
virtual INPLJabberClient * | GetJabberClient (const char *sJID) |
get an existing jabber client instance interface by its JID. More... | |
virtual INPLJabberClient * | CreateJabberClient (const char *sJID) |
Create a new jabber client instance with the given jabber client ID. More... | |
virtual bool | CloseJabberClient (const char *sJID) |
close a given jabber client instance. More... | |
virtual void | AsyncDownload (const char *url, const char *destFolder, const char *callbackScript, const char *DownloaderName) |
Asynchronously download a file from the url. More... | |
virtual void | CancelDownload (const char *DownloaderName) |
cancel all asynchronous downloads that matches a certain downloader name pattern More... | |
virtual int | Download (const char *url, const char *destFolder, const char *callbackScript, const char *DownloaderName) |
Synchronous call of the function AsyncDownload(). More... | |
virtual int | ProcessResults () |
this function is called once on each frame to polling all results and calling the callbacks in scripting interface More... | |
virtual int | ProcessDownloaderResults () |
this function is called once on each frame to polling all results and calling the callbacks in scripting interface More... | |
virtual void | DeleteThis () |
delete this object when it is no longer needed. More... | |
virtual bool | AppendURLRequest (CURLRequestTask *pUrlTask, const char *sPoolName=NULL) |
Append URL request to a pool. More... | |
virtual bool | ChangeRequestPoolSize (const char *sPoolName, int nCount) |
There is generally no limit to the number of requests sent. More... | |
virtual int | ProcessUrlRequests () |
this function is called once on each frame to polling all results and calling the callbacks in scripting interface More... | |
void | AddPendingRequest (const char *sURL) |
add a string url to a set. More... | |
bool | HasPendingRequest (const char *sURL) |
whether the given request is already in the pending set. More... | |
void | RemovePendingRequest (const char *sURL) |
remove a string url from a set. More... | |
void | ClearAllPendingRequests () |
clear all pending request. More... | |
string | GetCachePath (const char *sFileUrl) |
get the md5 of sFileUrl. More... | |
void | Cleanup () |
just clean up everything. More... | |
Static Public Member Functions | |
static CNPLNetClient * | GetInstance () |
get a singleton instance of this class. More... | |
static void | ReleaseInstance () |
release the instance if it has not been released yet | |
Protected Member Functions | |
CRequestTaskPool * | CreateGetRequestTaskPool (const char *sPoolName=NULL) |
get a task pool by name. More... | |
Option names.
These must be well-formed XML element names.
void ParaEngine::CNPLNetClient::AddPendingRequest | ( | const char * | sURL | ) |
add a string url to a set.
this is used for tracking in processing requests. this function is called automatically when AppendURLRequest is called.
|
virtual |
Append URL request to a pool.
connections in the same pool are reused as much as possible. There is generally no limit to the number of requests sent. However, each pool has a specified maximum number of concurrent worker slots. the default number is 1. One can change this number with ChangeRequestPoolSize.
pUrlTask | must be new CURLRequestTask(), the ownership of the task is transfered to the manager. so the caller should never delete the pointer. |
sPoolName | the request pool name. If the pool does not exist, it will be created. If null, the default pool is used. there are some reserved pool names used by ParaEngine. They are:
|
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
Asynchronously download a file from the url.
callbackScript | script code to be called, a global variable called msg is assigned, as below msg = {DownloadState=""|"complete"|"terminated", totalFileSize=number, currentFileSize=number, PercentDone=number} |
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
cancel all asynchronous downloads that matches a certain downloader name pattern
DownloaderName:regular | expression. such as "proc1", "proc1.*", ".*" |
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
There is generally no limit to the number of requests sent.
However, each pool has a specified maximum number of concurrent worker slots. the default number is 1. One can change this number with this function.
Implements ParaEngine::INPLWebServiceClient.
void ParaEngine::CNPLNetClient::Cleanup | ( | ) |
just clean up everything.
void ParaEngine::CNPLNetClient::ClearAllPendingRequests | ( | ) |
clear all pending request.
|
virtual |
close a given jabber client instance.
Basically, there is no need to close a web service, unless one wants to reopen it with different credentials
sJID | such as "lixizhi@paraweb3d.com" |
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
close a given web service.
Basically, there is no need to close a web service, unless one wants to reopen it with different credentials
Implements ParaEngine::INPLWebServiceClient.
|
protected |
get a task pool by name.
and create it if it does not exist.
|
virtual |
Create a new jabber client instance with the given jabber client ID.
It does not open a connection immediately.
sJID | such as "lixizhi@paraweb3d.com" |
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
delete this object when it is no longer needed.
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
Synchronous call of the function AsyncDownload().
This function will not return until download is complete or an error occurs. this function is rarely used. AsyncDownload() is used.
Implements ParaEngine::INPLWebServiceClient.
string ParaEngine::CNPLNetClient::GetCachePath | ( | const char * | sFileUrl | ) |
get the md5 of sFileUrl.
the returned value is URLEncoded.
|
static |
get a singleton instance of this class.
|
virtual |
get an existing jabber client instance interface by its JID.
If the client is not created using CreateJabberClient() before, function may return NULL.
sJID | such as "lixizhi@paraweb3d.com" |
Implements ParaEngine::INPLWebServiceClient.
bool ParaEngine::CNPLNetClient::HasPendingRequest | ( | const char * | sURL | ) |
whether the given request is already in the pending set.
one can use this function to check whether there is a pending request due to previous call of AppendURLRequest
|
virtual |
open a new web service with optional credentials
sURL | url of the web service, such as http://paraengine.com/test.asmx |
sUserName | the user name associated with the credentials |
sPassword | the password for the user name associated with the credentials. |
sDomain | the domain or computer name that verifies the credentials |
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
this function is called once on each frame to polling all results and calling the callbacks in scripting interface
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
this function is called once on each frame to polling all results and calling the callbacks in scripting interface
Implements ParaEngine::INPLWebServiceClient.
|
virtual |
this function is called once on each frame to polling all results and calling the callbacks in scripting interface
Implements ParaEngine::INPLWebServiceClient.
void ParaEngine::CNPLNetClient::RemovePendingRequest | ( | const char * | sURL | ) |
remove a string url from a set.
This function is automatically called when a url request is completed.