1 #ifndef MSP_NET_STREAMSOCKET_H_
2 #define MSP_NET_STREAMSOCKET_H_
4 #include "clientsocket.h"
9 class StreamSocket: public ClientSocket
11 friend class StreamServerSocket;
14 /** Emitted when the socket finishes connecting. The argument is a
15 platform-dependent error code. */
16 sigc::signal<void, int> signal_connect_finished;
19 /// Used by StreamListenSocket to construct a new socket from accept.
20 StreamSocket(const Private &, const SockAddr &);
22 StreamSocket(Family, int = 0);
24 /** Connects to a remote address. StreamSockets must be connected before
25 data can be sent and received. Returns 0 if the connection was successfully
26 established, 1 if it's in progress.
28 If the socket is non-blocking, this function may return before the
29 connection is fully established. The caller must then use either the
30 poll_connect function or an EventDispatcher to finish the process. */
31 virtual bool connect(const SockAddr &);
33 virtual bool poll_connect(const Time::TimeDelta &);
36 void on_event(IO::PollEvent);