1 #ifndef MSP_NET_SOCKET_H_
2 #define MSP_NET_SOCKET_H_
4 #include <msp/io/eventobject.h>
5 #include <msp/io/handle.h>
12 class bad_socket_state: public std::logic_error
15 bad_socket_state(const std::string &w): std::logic_error(w) { }
16 virtual ~bad_socket_state() throw() { }
20 class Socket: public IO::EventObject
28 Socket(const Private &);
29 Socket(Family, int, int);
33 virtual void set_block(bool);
34 virtual const IO::Handle &get_event_handle();
36 /** Associates the socket with a local address. There must be no existing
37 users of the address. */
38 void bind(const SockAddr &);
40 const SockAddr &get_local_address() const;
42 void set_timeout(const Time::TimeDelta &);