]> git.tdb.fi Git - libs/net.git/blobdiff - source/net/socket.h
Adjust exception classes and messages
[libs/net.git] / source / net / socket.h
index 1f60f9bb2276942ce31e7eaf69612e4e67641f02..2e736e9a21d04ffaac1f77a704ae50f3f4ed056b 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_NET_SOCKET_H_
 #define MSP_NET_SOCKET_H_
 
+#include <msp/core/except.h>
 #include <msp/io/eventobject.h>
 #include <msp/io/handle.h>
 #include "constants.h"
 namespace Msp {
 namespace Net {
 
-class bad_socket_state: public std::logic_error
+class bad_socket_state: public invalid_state
 {
 public:
-       bad_socket_state(const std::string &w): std::logic_error(w) { }
-       virtual ~bad_socket_state() throw() { }
+       bad_socket_state(const std::string &w): invalid_state(w) { }
 };
 
 
@@ -42,12 +42,15 @@ public:
        ~Socket();
 
        virtual void set_block(bool);
+       virtual void set_inherit(bool);
+       const IO::Handle &get_handle(IO::Mode);
        virtual const IO::Handle &get_event_handle();
 
        /** Associates the socket with a local address.  There must be no existing
        users of the address. */
        void bind(const SockAddr &);
 
+       bool is_bound() const { return local_addr; }
        const SockAddr &get_local_address() const;
 
        void set_timeout(const Time::TimeDelta &);