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
19 ClientSocket(const Private &, const SockAddr &);
20 ClientSocket(Family, int, int);
22 virtual ~ClientSocket();
24 /** Connects to a remote address. Exact semantics depend on the socket
25 type. Returns true if the connection was established, false if it's in
27 virtual bool connect(const SockAddr &) = 0;
29 /** Checks the status of a connection being established. Returns true if
30 the connection was established successfully, false if it's still in
31 progress. If an error occurred, an exception is thrown. */
32 virtual bool poll_connect(const Time::TimeDelta &) = 0;
34 bool is_connecting() const { return connecting; }
35 bool is_connected() const { return connected; }
37 const SockAddr &get_peer_address() const;
39 virtual unsigned do_write(const char *, unsigned);
40 virtual unsigned do_read(char *, unsigned);