]> git.tdb.fi Git - libs/net.git/blob - source/streamsocket.h
Reorder class members
[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 private:
20         bool connecting;
21
22 public:
23         /**
24         Emitted when the socket finishes connecting.  The argument is a standard
25         error code, 0 indicating success.
26         */
27         sigc::signal<void, int> signal_connect_finished;
28
29 private:
30         StreamSocket(SocketHandle, const SockAddr &);
31 public:
32         StreamSocket(Family, int =0);
33
34         bool is_connecting() const { return connecting; }
35         int poll_connect(const Time::TimeDelta &);
36         int connect(const SockAddr &);
37 private:
38         void on_event(IO::PollEvent);
39 };
40
41 } // namespace Net
42 } // namespace Msp
43
44 #endif