00001 #include "CSocket.h" 00002 00003 using namespace std; 00004 00005 00007 CSocket::CSocket(): 00008 mSocketDescriptor(0), 00009 mIsInitialized(0){ 00010 }; 00012 CSocket::~CSocket(){ 00013 if(mIsInitialized 00014 && mSocketDescriptor){ 00015 close(mSocketDescriptor); 00016 } 00017 }; 00019 int CSocket::getSocketDescriptor()const{ 00020 return mSocketDescriptor; 00021 }; 00023 void CSocket::setServeFunction(CSocket::CServeFunction* inServeFunction){ 00024 mServeFunction=inServeFunction; 00025 }; 00027 void CSocket::serveStream(int inAcceptedSocket){ 00028 mServeFunction->operator()(inAcceptedSocket); 00029 }; 00031 CSocket::operator bool()const{ 00032 return mIsInitialized; 00033 };
1.5.6