本文整理汇总了C++中SocketEndpoint::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ SocketEndpoint::isNull方法的具体用法?C++ SocketEndpoint::isNull怎么用?C++ SocketEndpoint::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketEndpoint
的用法示例。
在下文中一共展示了SocketEndpoint::isNull方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateDaliEnv
bool updateDaliEnv(IPropertyTree *env, bool forceGroupUpdate, const char *daliIp)
{
Owned<IPropertyTreeIterator> dalis = env->getElements("Software/DaliServerProcess/Instance");
if (!dalis||!dalis->first()) {
fprintf(stderr,"Could not find DaliServerProcess\n");
return false;
}
SocketEndpoint daliep;
loop {
const char *ps = dalis->get().queryProp("@port");
unsigned port = ps?atoi(ps):0;
if (!port)
port = DALI_SERVER_PORT;
daliep.set(dalis->get().queryProp("@netAddress"),port);
if (daliIp && *daliIp) {
SocketEndpoint testep;
testep.set(daliIp,DALI_SERVER_PORT);
if (testep.equals(daliep))
break;
daliep.set(NULL,0);
}
if (!dalis->next())
break;
if (!daliep.isNull()) {
fprintf(stderr,"Ambiguous DaliServerProcess instance\n");
return false;
}
}
if (daliep.isNull()) {
fprintf(stderr,"Could not find DaliServerProcess instance\n");
return false;
}
SocketEndpointArray epa;
epa.append(daliep);
Owned<IGroup> group = createIGroup(epa);
bool ret = true;
initClientProcess(group, DCR_Util);
StringBuffer response;
if (querySDS().updateEnvironment(env, forceGroupUpdate, response))
{
StringBuffer tmp;
PROGLOG("Environment and node groups updated in dali at %s",daliep.getUrlStr(tmp).str());
}
else
ret = false;
if (response.length())
WARNLOG("%s", response.str());
closedownClientProcess();
return ret;
}
示例2: runLocalDaFileSvr
bool CDfuPlusHelper::runLocalDaFileSvr(SocketEndpoint &listenep,bool requireauthenticate, unsigned timeout)
{
Owned<CDafsThread> thr = new CDafsThread(listenep,requireauthenticate);
if (!thr->ok())
return false;
thr->start();
StringBuffer eps;
if (listenep.isNull())
progress("Started local Dali file server on port %d\n", listenep.port?listenep.port:DAFILESRV_PORT);
else
progress("Started local Dali file server on %s\n", listenep.getUrlStr(eps).str());
if (timeout==0) {
setDafsTrace(NULL,0); // disable client tracing
dafsthread.setown(thr.getClear());
}
else {
loop {
Sleep(500);
if (thr->idleTime()>timeout) {
thr->stop();
break;
}
}
}
return true;
}
示例3: CDafsThread
CDafsThread(SocketEndpoint &_listenep,bool requireauthenticate)
: listenep(_listenep)
{
if (listenep.port==0)
listenep.port = DAFILESRV_PORT;
StringBuffer eps;
if (listenep.isNull())
eps.append(listenep.port);
else
listenep.getUrlStr(eps);
enableDafsAuthentication(requireauthenticate);
server.setown(createRemoteFileServer());
}
示例4: run
void run()
{
// Get params from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DaFileSrv\Parameters
int requireauthenticate=0;
HKEY hkey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\DaFileSrv\\Parameters",
0,
KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS) {
DWORD dwType = 0;
DWORD dwSize = sizeof(requireauthenticate);
RegQueryValueEx(hkey,
"RequireAuthentication",
NULL,
&dwType,
(BYTE*)&requireauthenticate,
&dwSize);
RegCloseKey(hkey);
}
StringBuffer eps;
if (listenep.isNull())
eps.append(listenep.port);
else
listenep.getUrlStr(eps);
enableDafsAuthentication(requireauthenticate!=0);
PROGLOG("Opening " DAFS_SERVICE_DISPLAY_NAME " on %s%s", useSSL?"SECURE ":"",eps.str());
const char * verstring = remoteServerVersionString();
PROGLOG("Version: %s", verstring);
PROGLOG("Authentication:%s required",requireauthenticate?"":" not");
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Running");
server.setown(createRemoteFileServer(maxThreads, maxThreadsDelayMs, maxAsyncCopy));
server->setThrottle(ThrottleStd, parallelRequestLimit, throttleDelayMs, throttleCPULimit);
server->setThrottle(ThrottleSlow, parallelSlowRequestLimit, throttleSlowDelayMs, throttleSlowCPULimit);
try {
server->run(listenep, useSSL);
}
catch (IException *e) {
EXCLOG(e,DAFS_SERVICE_NAME);
e->Release();
}
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Stopped");
stopped = true;
}
示例5: main
//.........这里部分代码省略.........
{
if (stopped||!running()) {
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Stopping");
if (server) {
server->stop();
server.clear();
}
return false;
}
return true;
}
void run()
{
// Get params from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DaFileSrv\Parameters
int requireauthenticate=0;
HKEY hkey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\DaFileSrv\\Parameters",
0,
KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS) {
DWORD dwType = 0;
DWORD dwSize = sizeof(requireauthenticate);
RegQueryValueEx(hkey,
"RequireAuthentication",
NULL,
&dwType,
(BYTE*)&requireauthenticate,
&dwSize);
RegCloseKey(hkey);
}
StringBuffer eps;
if (listenep.isNull())
eps.append(listenep.port);
else
listenep.getUrlStr(eps);
enableDafsAuthentication(requireauthenticate!=0);
PROGLOG("Opening " DAFS_SERVICE_DISPLAY_NAME " on %s%s", useSSL?"SECURE ":"",eps.str());
const char * verstring = remoteServerVersionString();
PROGLOG("Version: %s", verstring);
PROGLOG("Authentication:%s required",requireauthenticate?"":" not");
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Running");
server.setown(createRemoteFileServer(parallelRequestLimit, throttleDelayMs, throttleCPULimit));
try {
server->run(listenep, useSSL);
}
catch (IException *e) {
EXCLOG(e,DAFS_SERVICE_NAME);
e->Release();
}
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Stopped");
stopped = true;
}
} service(listenep, useSSL);
service.start();
return 0;
#else
int ret = initDaemon();
if (ret)
return ret;
#endif
}
{
Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(logDir.str(), "DAFILESRV");
lf->setCreateAliasFile(false);
lf->setMaxDetail(TopDetail);
lf->beginLogging();
}
PROGLOG("Parallel request limit = %d, throttleDelayMs = %d, throttleCPULimit = %d", parallelRequestLimit, throttleDelayMs, throttleCPULimit);
const char * verstring = remoteServerVersionString();
StringBuffer eps;
if (listenep.isNull())
eps.append(listenep.port);
else
listenep.getUrlStr(eps);
enableDafsAuthentication(requireauthenticate);
PROGLOG("Opening Dali File Server on %s%s", useSSL?"SECURE ":"",eps.str());
PROGLOG("Version: %s", verstring);
PROGLOG("Authentication:%s required",requireauthenticate?"":" not");
startPerformanceMonitor(10*60*1000, PerfMonStandard);
server.setown(createRemoteFileServer(parallelRequestLimit, throttleDelayMs, throttleCPULimit));
writeSentinelFile(sentinelFile);
try {
server->run(listenep, useSSL);
}
catch (IException *e) {
EXCLOG(e,"DAFILESRV");
e->Release();
}
if (server)
server->stop();
server.clear();
PROGLOG("Stopped Dali File Server");
return 0;
}
示例6: main
//.........这里部分代码省略.........
}
bool poll()
{
if (stopped||!running()) {
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Stopping");
if (server) {
server->stop();
server.clear();
}
return false;
}
return true;
}
void run()
{
// Get params from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DaFileSrv\Parameters
int requireauthenticate=0;
HKEY hkey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\DaFileSrv\\Parameters",
0,
KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS) {
DWORD dwType = 0;
DWORD dwSize = sizeof(requireauthenticate);
RegQueryValueEx(hkey,
"RequireAuthentication",
NULL,
&dwType,
(BYTE*)&requireauthenticate,
&dwSize);
RegCloseKey(hkey);
}
StringBuffer eps;
if (listenep.isNull())
eps.append(listenep.port);
else
listenep.getUrlStr(eps);
enableDafsAuthentication(requireauthenticate!=0);
PROGLOG("Opening "DAFS_SERVICE_DISPLAY_NAME" on %s", eps.str());
const char * verstring = remoteServerVersionString();
PROGLOG("Version: %s", verstring);
PROGLOG("Authentication:%s required",requireauthenticate?"":" not");
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Running");
server.setown(createRemoteFileServer());
try {
server->run(listenep);
}
catch (IException *e) {
EXCLOG(e,DAFS_SERVICE_NAME);
e->Release();
}
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Stopped");
stopped = true;
}
} service(listenep);
service.start();
return 0;
#else
int ret = initDaemon();
if (ret)
return ret;
#endif
}
{
Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(logDir.str(), "DAFILESRV");
lf->setCreateAliasFile(false);
lf->setMaxDetail(TopDetail);
lf->beginLogging();
}
const char * verstring = remoteServerVersionString();
StringBuffer eps;
if (listenep.isNull())
eps.append(listenep.port);
else
listenep.getUrlStr(eps);
enableDafsAuthentication(requireauthenticate);
PROGLOG("Opening Dali File Server on %s", eps.str());
PROGLOG("Version: %s", verstring);
PROGLOG("Authentication:%s required",requireauthenticate?"":" not");
startPerformanceMonitor(10*60*1000, PerfMonStandard);
server.setown(createRemoteFileServer());
writeSentinelFile(sentinelFile);
try {
server->run(listenep);
}
catch (IException *e) {
EXCLOG(e,"DAFILESRV");
e->Release();
}
if (server)
server->stop();
server.clear();
PROGLOG("Stopped Dali File Server");
return 0;
}