00001 /* 00002 * $Id: SocketBase.cpp,v 1.4 2002/07/08 04:58:12 mindstorm2600 Exp $ 00003 * This is the socket's parent class 00004 */ 00005 00006 #include"SocketBase.h" 00007 #include<sys/socket.h> 00008 #include<netdb.h> 00009 namespace clawsoft{ 00010 00011 SocketBase::SocketBase():Object("SocketBase"){;} 00012 00013 int SocketBase::setSockOption(int opname, void *optval, unsigned int siz){ 00014 #ifdef SOLARIS 00015 char *optval1; 00016 optval1 = (char *)optval; 00017 return setsockopt(sock, SOL_SOCKET, opname, optval1, sizeof(optval)); 00018 #else 00019 return setsockopt(sock, SOL_SOCKET, opname, optval, sizeof(optval)); 00020 #endif 00021 } 00022 00023 int SocketBase::setTCPOption(int opname, void *optval, unsigned int siz){ 00024 //return setsockopt(sock, SOL_TCP, opname, optval, sizeof(optval)); 00025 return 0; 00026 } 00027 00028 int SocketBase::setSoTimeout(int t){ 00029 return setSockOption(SO_KEEPALIVE, &t, sizeof(int)); 00030 } 00031 };
Powered by: