socklen_t len = sizeof(ling);
::memset(&ling,sizeof(ling),0);
if (::getsockopt(fd(),SOL_SOCKET,SO_LINGER,&ling,&len) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
return std::make_pair(ling.l_onoff, ling.l_linger);
}
ling.l_onoff = enable;
ling.l_linger = timeout;
if (::setsockopt(fd(),SOL_SOCKET,SO_LINGER,&ling,sizeof(ling)) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
}
prefix_ boost::uint8_t senf::BSDSocketProtocol::priority()
int value;
socklen_t len (sizeof(value));
if (::getsockopt(fd(),SOL_SOCKET,SO_PRIORITY,&value,&len) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
return value;
}
{
int ivalue (value);
if (::setsockopt(fd(),SOL_SOCKET,SO_PRIORITY,&ivalue,sizeof(ivalue)) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
+}
+
+prefix_ int senf::BSDSocketProtocol::error()
+ const
+{
+ int err;
+ socklen_t len (sizeof(err));
+ if (::getsockopt(fd(),SOL_SOCKET,SO_ERROR,&err,&len) < 0)
+ SENF_THROW_SYSTEM_EXCEPTION("");
+ return err;
}
prefix_ unsigned senf::BSDSocketProtocol::rcvbuf()
unsigned size;
socklen_t len (sizeof(size));
if (::getsockopt(fd(),SOL_SOCKET,SO_RCVBUF,&size,&len) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
// Linux doubles the bufer size on setting the RCVBUF to cater for internal
// headers. We fix this up here .. (see lkml FAQ)
return size/2;
const
{
if (::setsockopt(fd(),SOL_SOCKET,SO_RCVBUF,&size,sizeof(size)) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
}
prefix_ unsigned senf::BSDSocketProtocol::sndbuf()
unsigned size;
socklen_t len (sizeof(size));
if (::getsockopt(fd(),SOL_SOCKET,SO_SNDBUF,&size,&len) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
// Linux doubles the bufer size on setting the SNDBUF to cater for internal
// headers. We fix this up here .. (see lkml FAQ)
return size/2;
const
{
if (::setsockopt(fd(),SOL_SOCKET,SO_SNDBUF,&size,sizeof(size)) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
}
///////////////////////////////////////////////////////////////////////////
int value;
socklen_t len (sizeof(value));
if (::getsockopt(fd(),SOL_SOCKET,SO_REUSEADDR,&value,&len) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
return value;
}
{
int ivalue (value);
if (::setsockopt(fd(),SOL_SOCKET,SO_REUSEADDR,&ivalue,sizeof(ivalue)) < 0)
- throw SystemException();
+ SENF_THROW_SYSTEM_EXCEPTION("");
}
/////////////////////////////cc.e////////////////////////////////////////