]> git.tdb.fi Git - libs/net.git/blob - source/streamsocket.h
0bba5c39c1be7adff4d06cc85802368871b7610a
[libs/net.git] / source / streamsocket.h
1 /* $Id$
2
3 This file is part of libmspnet
4 Copyright © 2008  Mikkosoft Productions, Mikko Rasa
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_NET_STREAMSOCKET_H_
9 #define MSP_NET_STREAMSOCKET_H_
10
11 #include "socket.h"
12
13 namespace Msp {
14 namespace Net {
15
16 class StreamSocket: public Socket
17 {
18         friend class StreamListenSocket;
19 public:
20         /**
21         Emitted when the socket finishes connecting.  The argument is a standard
22         error code, 0 indicating success.
23         */
24         sigc::signal<void, int> signal_connect_finished;
25
26         StreamSocket(Family, int =0);
27         bool get_connecting() const { return connecting; }
28         int poll_connect(const Time::TimeDelta &);
29         int connect(const SockAddr &);
30 private:
31         bool connecting;
32
33         StreamSocket(SocketHandle, const SockAddr &);
34         void on_event(IO::PollEvent);
35 };
36
37 } // namespace Net
38 } // namespace Msp
39
40 #endif