1 #ifndef MSP_NET_CLIENTSOCKET_H_
2 #define MSP_NET_CLIENTSOCKET_H_
10 ClientSockets are used for sending and receiving data over the network.
12 class ClientSocket: public Socket
15 /** Emitted when the socket finishes connecting. The argument is a
16 platform-dependent error code. */
17 sigc::signal<void, int> signal_connect_finished;
24 ClientSocket(const Private &, const SockAddr &);
25 ClientSocket(Family, int, int);
27 virtual ~ClientSocket();
29 /** Connects to a remote address. Exact semantics depend on the socket
30 type. Returns true if the connection was established, false if it's in
32 virtual bool connect(const SockAddr &) = 0;
34 /** Checks the status of a connection being established. Returns true if
35 the connection was established successfully, false if it's still in
36 progress. If an error occurred, an exception is thrown. */
37 virtual bool poll_connect(const Time::TimeDelta &) = 0;
39 bool is_connecting() const { return connecting; }
40 bool is_connected() const { return connected; }
42 const SockAddr &get_peer_address() const;
44 virtual unsigned do_write(const char *, unsigned);
45 virtual unsigned do_read(char *, unsigned);