29 lines
577 B
C++
29 lines
577 B
C++
#include <SmingCore/SmingCore.h>
|
|
#include <TcpPublish.h>
|
|
#include <stdint.h>
|
|
|
|
TcpPublish::TcpPublish() : TcpServer() {
|
|
};
|
|
|
|
int TcpPublish::write(const char * str, int len) {
|
|
int i = 0;
|
|
for ( i=0; i < clients.count(); i++ ) {
|
|
clients[i]->write(str, len);
|
|
}
|
|
return i;
|
|
};
|
|
|
|
void TcpPublish::onClient(TcpClient* client) {
|
|
clients.addElement(client);
|
|
};
|
|
|
|
void TcpPublish::onClientComplete(TcpClient* client) {
|
|
for ( int i=0; i < clients.count(); i++ ) {
|
|
if(client == clients[i]){
|
|
clients.remove(i);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|