X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstreamsocket.h;fp=source%2Fstreamsocket.h;h=0bba5c39c1be7adff4d06cc85802368871b7610a;hb=f59eded7c3e162bbdfc6db424c9badc730017698;hp=0000000000000000000000000000000000000000;hpb=fab500d5bff644bb5637abd2f5e78baeb26b7f26;p=libs%2Fnet.git diff --git a/source/streamsocket.h b/source/streamsocket.h new file mode 100644 index 0000000..0bba5c3 --- /dev/null +++ b/source/streamsocket.h @@ -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 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