Page 918 - 3-3
P. 918
}
} catch (sql::SQLException &e) {
std::cerr << std::endl;
std::cerr << "Error occured in CheckLogin(), SQL error" << std::endl;
std::cerr << e.what() << std::endl;
std::cerr << std::endl;
delete[] name;
name = NULL;
}
delete res;
return name;
}
void Handler::Run() {
InitSQL();
while(Power) {
reads = ori_reads;
select(maxfd + 1, &reads, NULL, NULL, NULL);
// If client request new connection
if (FD_ISSET(ServerSocket, &reads)) {
ProcNewConn();
continue;
}
// Check changed FD
for (int fd = ServerSocket + 1; fd <= maxfd; fd++) {
// If the FD is readable
if (FD_ISSET(fd, &reads)) {
char type = 0;
int res = 0;
try {
if (fd == RaspSocket) {
try { res = Server->recv(&type, sizeof(type), fd); }
catch (TcpServerSock::Exception &e) {
RaspSocket = 0;
throw e;
}
}
else
res = Server->recv(&type, sizeof(type), fd);
}
catch (TcpServerSock::Exception &e) {
- 918 -