]> git.tdb.fi Git - libs/net.git/blobdiff - source/streamsocket.h
Initial revision
[libs/net.git] / source / streamsocket.h
diff --git a/source/streamsocket.h b/source/streamsocket.h
new file mode 100644 (file)
index 0000000..0bba5c3
--- /dev/null
@@ -0,0 +1,40 @@
+/* $Id$
+
+This file is part of libmspnet
+Copyright © 2008  Mikkosoft Productions, Mikko Rasa
+Distributed under the LGPL
+*/
+
+#ifndef MSP_NET_STREAMSOCKET_H_
+#define MSP_NET_STREAMSOCKET_H_
+
+#include "socket.h"
+
+namespace Msp {
+namespace Net {
+
+class StreamSocket: public Socket
+{
+       friend class StreamListenSocket;
+public:
+       /**
+       Emitted when the socket finishes connecting.  The argument is a standard
+       error code, 0 indicating success.
+       */
+       sigc::signal<void, int> signal_connect_finished;
+
+       StreamSocket(Family, int =0);
+       bool get_connecting() const { return connecting; }
+       int poll_connect(const Time::TimeDelta &);
+       int connect(const SockAddr &);
+private:
+       bool connecting;
+
+       StreamSocket(SocketHandle, const SockAddr &);
+       void on_event(IO::PollEvent);
+};
+
+} // namespace Net
+} // namespace Msp
+
+#endif