X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Fstreamsocket.h;fp=source%2Fnet%2Fstreamsocket.h;h=8b39e91afd358214168c977e299e01bc714d3e76;hb=50e9f9ea7f7385a2c5931fca2b8fb1103078e67c;hp=0000000000000000000000000000000000000000;hpb=21c596567e3b6fd794ed6af73d304ce2bc70e58f;p=libs%2Fnet.git diff --git a/source/net/streamsocket.h b/source/net/streamsocket.h new file mode 100644 index 0000000..8b39e91 --- /dev/null +++ b/source/net/streamsocket.h @@ -0,0 +1,37 @@ +#ifndef MSP_NET_STREAMSOCKET_H_ +#define MSP_NET_STREAMSOCKET_H_ + +#include "clientsocket.h" + +namespace Msp { +namespace Net { + +class StreamSocket: public ClientSocket +{ + friend class StreamServerSocket; + +private: + /// Used by StreamListenSocket to construct a new socket from accept. + StreamSocket(const Private &, const SockAddr &); +public: + StreamSocket(Family, int = 0); + + /** Connects to a remote address. StreamSockets must be connected before + data can be sent and received. Returns 0 if the connection was successfully + established, 1 if it's in progress. + + If the socket is non-blocking, this function may return before the + connection is fully established. The caller must then use either the + poll_connect function or an EventDispatcher to finish the process. */ + virtual bool connect(const SockAddr &); + + virtual bool poll_connect(const Time::TimeDelta &); + +private: + void on_event(IO::PollEvent); +}; + +} // namespace Net +} // namespace Msp + +#endif