]> git.tdb.fi Git - libs/net.git/blobdiff - source/socket.h
Remove the close method from Socket, making it more RAII
[libs/net.git] / source / socket.h
index 5536146544c3de098993d1af06295caeecd075be..dbe31512a6f677eeed424d3a12748a50d8fc87eb 100644 (file)
 namespace Msp {
 namespace Net {
 
+class bad_socket_state: public std::logic_error
+{
+public:
+       bad_socket_state(const std::string &w): std::logic_error(w) { }
+       virtual ~bad_socket_state() throw() { }
+};
+
+
 class Socket: public IO::EventObject
 {
 protected:
@@ -37,9 +45,6 @@ public:
        type. */
        virtual int connect(const SockAddr &) = 0;
 
-       /// Closes the socket.  Most operations will throw an exception after this.
-       void close();
-
        void set_timeout(const Time::TimeDelta &);
        const SockAddr &get_local_address() const;
        const SockAddr &get_peer_address() const;