Utils/Console: Add short help to 'ls' output
[senf.git] / Socket / Protocols / BSDSocketProtocol.cc
index 79754e5..4524cae 100644 (file)
@@ -41,7 +41,7 @@ prefix_ std::pair<bool,unsigned> senf::BSDSocketProtocol::linger()
 {
     struct linger ling;
     socklen_t len = sizeof(ling);
-    ::memset(&ling,sizeof(ling),0);
+    ::memset(&ling, 0, sizeof(ling));
     if (::getsockopt(fd(),SOL_SOCKET,SO_LINGER,&ling,&len) < 0)
         SENF_THROW_SYSTEM_EXCEPTION("");
     return std::make_pair(ling.l_onoff, ling.l_linger);
@@ -75,6 +75,16 @@ prefix_ void senf::BSDSocketProtocol::priority(boost::uint8_t value)
         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()
     const
 {
@@ -137,7 +147,7 @@ prefix_ void senf::AddressableBSDSocketProtocol::reuseaddr(bool value)
 #undef prefix_
 //#include "BSDSocketProtocol.mpp"
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100