| 1 | // |
| 2 | // StreamSocketImpl.h |
| 3 | // |
| 4 | // Library: Net |
| 5 | // Package: Sockets |
| 6 | // Module: StreamSocketImpl |
| 7 | // |
| 8 | // Definition of the StreamSocketImpl class. |
| 9 | // |
| 10 | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Net_StreamSocketImpl_INCLUDED |
| 18 | #define Net_StreamSocketImpl_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Net/Net.h" |
| 22 | #include "Poco/Net/SocketImpl.h" |
| 23 | |
| 24 | |
| 25 | namespace Poco { |
| 26 | namespace Net { |
| 27 | |
| 28 | |
| 29 | class Net_API StreamSocketImpl: public SocketImpl |
| 30 | /// This class implements a TCP socket. |
| 31 | { |
| 32 | public: |
| 33 | StreamSocketImpl(); |
| 34 | /// Creates a StreamSocketImpl. |
| 35 | |
| 36 | explicit StreamSocketImpl(SocketAddress::Family addressFamily); |
| 37 | /// Creates a SocketImpl, with the underlying |
| 38 | /// socket initialized for the given address family. |
| 39 | |
| 40 | StreamSocketImpl(poco_socket_t sockfd); |
| 41 | /// Creates a StreamSocketImpl using the given native socket. |
| 42 | |
| 43 | virtual int sendBytes(const void* buffer, int length, int flags = 0); |
| 44 | /// Ensures that all data in buffer is sent if the socket |
| 45 | /// is blocking. In case of a non-blocking socket, sends as |
| 46 | /// many bytes as possible. |
| 47 | /// |
| 48 | /// Returns the number of bytes sent. The return value may also be |
| 49 | /// negative to denote some special condition. |
| 50 | |
| 51 | protected: |
| 52 | virtual ~StreamSocketImpl(); |
| 53 | }; |
| 54 | |
| 55 | |
| 56 | } } // namespace Poco::Net |
| 57 | |
| 58 | |
| 59 | #endif // Net_StreamSocketImpl_INCLUDED |
| 60 | |