|
rllib
1
|
#include "rleventlogserver.h"#include "rlsocket.h"#include "rlcutil.h"#include "rltime.h"#include "stdio.h"#include "string.h"
Go to the source code of this file.
Classes | |
| struct | WORKER_DATA |
Functions | |
| static void * | workerThread (void *arg) |
| static void * | rlAcceptThread (void *arg) |
| static void* rlAcceptThread | ( | void * | arg | ) | [static] |
Definition at line 151 of file rleventlogserver.cpp.
{
int port,s;
rlThread worker;
WORKER_DATA worker_data;
rlEventLogServerThreads *thread;
rlSocket *socket;
THREAD_PARAM *p = (THREAD_PARAM *) arg;
thread = (rlEventLogServerThreads *) p->user;
port = thread->getPort();
socket = new rlSocket("localhost",port,0);
while(1)
{
s = socket->connect();
if(s == -1) break;
worker_data.thread = thread;
worker_data.socket = s;
worker.create(workerThread,&worker_data);
rlsleep(100);
}
delete socket;
return NULL;
}
| static void* workerThread | ( | void * | arg | ) | [static] |
Definition at line 128 of file rleventlogserver.cpp.
{
char message[rlMAX_EVENT];
int s,ret;
WORKER_DATA *worker_data;
rlEventLogServerThreads *thread;
rlSocket *socket;
THREAD_PARAM *p = (THREAD_PARAM *) arg;
worker_data = (WORKER_DATA *) p->user;
s = worker_data->socket;
thread = worker_data->thread;
socket = new rlSocket(s);
while(socket->isConnected())
{
ret = socket->readStr(message,sizeof(message)-1);
if(ret > 0) thread->event_log_server->putEvent(message);
}
delete socket;
return NULL;
}
1.7.5.1