X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Fclientsocket.h;h=80d927a330c63847c8a9cdfe88643681dad75680;hb=HEAD;hp=db684f4a5d32dc99ae873379eccc58eaea2df15a;hpb=debe1004676d5431e571d9c4361072661dcc88c4;p=libs%2Fnet.git diff --git a/source/net/clientsocket.h b/source/net/clientsocket.h index db684f4..80d927a 100644 --- a/source/net/clientsocket.h +++ b/source/net/clientsocket.h @@ -1,6 +1,7 @@ #ifndef MSP_NET_CLIENTSOCKET_H_ #define MSP_NET_CLIENTSOCKET_H_ +#include "mspnet_api.h" #include "socket.h" namespace Msp { @@ -9,16 +10,16 @@ namespace Net { /** ClientSockets are used for sending and receiving data over the network. */ -class ClientSocket: public Socket +class MSPNET_API ClientSocket: public Socket { public: /** Emitted when the socket finishes connecting. */ sigc::signal signal_connect_finished; protected: - bool connecting; - bool connected; - SockAddr *peer_addr; + bool connecting = false; + bool connected = false; + std::unique_ptr peer_addr; ClientSocket(const Private &, const SockAddr &); ClientSocket(Family, int, int); @@ -38,10 +39,12 @@ public: bool is_connecting() const { return connecting; } bool is_connected() const { return connected; } + void shutdown(IO::Mode); + const SockAddr &get_peer_address() const; protected: - virtual unsigned do_write(const char *, unsigned); - virtual unsigned do_read(char *, unsigned); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; }; } // namespace Net