29 #ifndef Pt_Net_TcpSocket_h
30 #define Pt_Net_TcpSocket_h
32 #include <Pt/Net/Api.h>
33 #include <Pt/Net/Endpoint.h>
34 #include <Pt/System/IODevice.h>
117 void beginConnect(
const Endpoint& ep);
137 {
return _connected; }
142 {
return _isConnected; }
146 void localEndpoint(
Endpoint& ep)
const;
150 void remoteEndpoint(
Endpoint& ep)
const;
154 virtual void onClose();
157 virtual void onSetTimeout(std::size_t timeout);
160 virtual bool onRun();
163 virtual std::size_t onBeginRead(
System::EventLoop& loop,
char* buffer, std::size_t n,
bool& eof);
166 virtual std::size_t onEndRead(
System::EventLoop& loop,
char* buffer, std::size_t n,
bool& eof);
169 virtual std::size_t onRead(
char* buffer, std::size_t count,
bool& eof);
172 virtual std::size_t onBeginWrite(
System::EventLoop& loop,
const char* buffer, std::size_t n);
175 virtual std::size_t onEndWrite(
System::EventLoop& loop,
const char* buffer, std::size_t n);
178 virtual std::size_t onWrite(
const char* buffer, std::size_t count);
181 virtual void onCancel();
185 class TcpSocketImpl* _impl;
201 #endif // Pt_Net_TcpSocket_h
TCP socket options.
Definition: TcpSocket.h:48
Signal< TcpSocket & > & connected()
Notifies that the socket was connected.
Definition: TcpSocket.h:136
Multicast Signal to call multiple slots.
Definition: Signal.h:109
Endpoint for I/O operations.
Definition: IODevice.h:55
Represents a Network Host.
Definition: Endpoint.h:46
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:72
bool isConnected() const
Returns true if connected.
Definition: TcpSocket.h:141
uint_type uint32_t
Unsigned 32-bit integer type.
Definition: Types.h:42
TCP client socket.
Definition: TcpSocket.h:74
TCP server socket.
Definition: TcpServer.h:99