/* client.cpp * * Copyright (c) 2000, Alexander Neundorf * neundorf@kde.org * * You may distribute under the terms of the GNU General Public * License as specified in the COPYING file. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include "netmanager.h" #include "client.h" #include "lisadefines.h" #include #include #include #ifdef LISA_DEBUG #undef LISA_DEBUG #endif #ifdef dcerr #undef dcerr #endif #define LISA_DEBUG 0 #define dcerr if (LISA_DEBUG==1) std::cerr<<"Client::" Client::Client(NetManager* tqparent, int socketFD, int closeOnDelete) :tqparentServer(tqparent) ,m_fd(socketFD) ,m_done(0) ,m_closeOnDelete(closeOnDelete) { dcerr<<"ctor created new client"<isInformed()) return 0; //we fork now, so that writing to the client can't block the server process /* int pid=fork(); if (pid==-1) { //tqparent dcerr<<"NetScanner::scan: error occurred"<writeDataToFD(fd(),0); close(); //exit(0); return 1; } void Client::close() { if (m_fd!=-1) ::close(m_fd); m_fd=-1; m_done=1; } void Client::read() { dcerr<<"read()"<=0) close(); } Client::~Client() { if (m_closeOnDelete) close(); }