1 #ifndef MSP_NET_STREAMSOCKET_H_
2 #define MSP_NET_STREAMSOCKET_H_
4 #include "clientsocket.h"
5 #include "mspnet_api.h"
10 class MSPNET_API StreamSocket: public ClientSocket
12 friend class StreamServerSocket;
15 /// Used by StreamListenSocket to construct a new socket from accept.
16 StreamSocket(const Private &, const SockAddr &);
18 StreamSocket(Family, int = 0);
20 /** Connects to a remote address. StreamSockets must be connected before
21 data can be sent and received. Returns 0 if the connection was successfully
22 established, 1 if it's in progress.
24 If the socket is non-blocking, this function may return before the
25 connection is fully established. The caller must then use either the
26 poll_connect function or an EventDispatcher to finish the process. */
27 bool connect(const SockAddr &) override;
29 bool poll_connect(const Time::TimeDelta &) override;
32 void on_event(IO::PollEvent) override;