TCPSocket
TCPSocket
#include <icy/net/tcpsocket.h>class TCPSocketDefined in src/net/include/icy/net/tcpsocket.h:30
Inherits:
Stream< uv_tcp_t >,SocketSubclassed by:SSLSocket
TCP socket implementation.
List of all members
| Name | Kind | Owner |
|---|---|---|
AcceptConnection | variable | Declared here |
TCPSocket | function | Declared here |
~TCPSocket | function | Declared here |
TCPSocket | function | Declared here |
operator= | function | Declared here |
TCPSocket | function | Declared here |
operator= | function | Declared here |
shutdown | function | Declared here |
close | function | Declared here |
connect | function | Declared here |
connect | function | Declared here |
send | function | Declared here |
sendOwned | function | Declared here |
send | function | Declared here |
sendOwned | function | Declared here |
bind | function | Declared here |
listen | function | Declared here |
acceptConnection | function | Declared here |
setReusePort | function | Declared here |
setNoDelay | function | Declared here |
setKeepAlive | function | Declared here |
setSimultaneousAccepts | function | Declared here |
setMode | function | Declared here |
mode | function | Declared here |
setError | function | Declared here |
error | function | Declared here |
closed | function | Declared here |
address | function | Declared here |
peerAddress | function | Declared here |
transport | function | Declared here |
loop | function | Declared here |
onConnect | function | Declared here |
onRead | function | Declared here |
onRecv | function | Declared here |
onError | function | Declared here |
onClose | function | Declared here |
_mode | variable | Declared here |
_peerAddress | variable | Declared here |
init | function | Declared here |
reset | function | Declared here |
Ptr | typedef | Declared here |
Vec | typedef | Declared here |
Read | variable | Inherited from Stream |
Stream | function | Inherited from Stream |
~Stream | function | Inherited from Stream |
close | function | Inherited from Stream |
shutdown | function | Inherited from Stream |
write | function | Inherited from Stream |
writeOwned | function | Inherited from Stream |
setHighWaterMark | function | Inherited from Stream |
write | function | Inherited from Stream |
stream | function | Inherited from Stream |
_buffer | variable | Inherited from Stream |
_started | variable | Inherited from Stream |
_highWaterMark | variable | Inherited from Stream |
_writeReqFree | variable | Inherited from Stream |
_ownedWriteReqFree | variable | Inherited from Stream |
readStart | function | Inherited from Stream |
readStop | function | Inherited from Stream |
onRead | function | Inherited from Stream |
allocWriteReq | function | Inherited from Stream |
freeWriteReq | function | Inherited from Stream |
allocOwnedWriteReq | function | Inherited from Stream |
freeOwnedWriteReq | function | Inherited from Stream |
canQueueWrite | function | Inherited from Stream |
Handle | typedef | Inherited from Stream |
Handle | function | Inherited from Handle |
~Handle | function | Inherited from Handle |
init | function | Inherited from Handle |
invoke | function | Inherited from Handle |
invokeOrThrow | function | Inherited from Handle |
close | function | Inherited from Handle |
ref | function | Inherited from Handle |
unref | function | Inherited from Handle |
initialized | function | Inherited from Handle |
active | function | Inherited from Handle |
closing | function | Inherited from Handle |
closed | function | Inherited from Handle |
error | function | Inherited from Handle |
setError | function | Inherited from Handle |
setUVError | function | Inherited from Handle |
setAndThrowError | function | Inherited from Handle |
throwLastError | function | Inherited from Handle |
loop | function | Inherited from Handle |
reset | function | Inherited from Handle |
get | function | Inherited from Handle |
tid | function | Inherited from Handle |
context | function | Inherited from Handle |
setCloseCleanup | function | Inherited from Handle |
clearCloseCleanup | function | Inherited from Handle |
assertThread | function | Inherited from Handle |
_loop | variable | Inherited from Handle |
_context | variable | Inherited from Handle |
_tid | variable | Inherited from Handle |
_error | variable | Inherited from Handle |
onError | function | Inherited from Handle |
onClose | function | Inherited from Handle |
Handle | function | Inherited from Handle |
operator= | function | Inherited from Handle |
Handle | function | Inherited from Handle |
operator= | function | Inherited from Handle |
Type | typedef | Inherited from Handle |
opaque | variable | Inherited from Socket |
Socket | function | Inherited from Socket |
~Socket | function | Inherited from Socket |
Socket | function | Inherited from Socket |
operator= | function | Inherited from Socket |
Socket | function | Inherited from Socket |
operator= | function | Inherited from Socket |
connect | function | Inherited from Socket |
connect | function | Inherited from Socket |
bind | function | Inherited from Socket |
listen | function | Inherited from Socket |
shutdown | function | Inherited from Socket |
sendOwned | function | Inherited from Socket |
sendOwned | function | Inherited from Socket |
close | function | Inherited from Socket |
address | function | Inherited from Socket |
peerAddress | function | Inherited from Socket |
transport | function | Inherited from Socket |
setError | function | Inherited from Socket |
error | function | Inherited from Socket |
closed | function | Inherited from Socket |
loop | function | Inherited from Socket |
_af | variable | Inherited from Socket |
init | function | Inherited from Socket |
reset | function | Inherited from Socket |
Ptr | typedef | Inherited from Socket |
Vec | typedef | Inherited from Socket |
priority | variable | Inherited from SocketAdapter |
SocketAdapter | function | Inherited from SocketAdapter |
~SocketAdapter | function | Inherited from SocketAdapter |
send | function | Inherited from SocketAdapter |
send | function | Inherited from SocketAdapter |
sendOwned | function | Inherited from SocketAdapter |
sendOwned | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
setSender | function | Inherited from SocketAdapter |
sender | function | Inherited from SocketAdapter |
addReceiver | function | Inherited from SocketAdapter |
removeReceiver | function | Inherited from SocketAdapter |
hasReceiver | function | Inherited from SocketAdapter |
receivers | function | Inherited from SocketAdapter |
onSocketConnect | function | Inherited from SocketAdapter |
onSocketRecv | function | Inherited from SocketAdapter |
onSocketError | function | Inherited from SocketAdapter |
onSocketClose | function | Inherited from SocketAdapter |
_sender | variable | Inherited from SocketAdapter |
_receivers | variable | Inherited from SocketAdapter |
_dirty | variable | Inherited from SocketAdapter |
cleanupReceivers | function | Inherited from SocketAdapter |
Inherited from Stream
| Kind | Name | Description |
|---|---|---|
variable | Read | Emitted when data has been received from the peer. |
function | Stream inline | Construct the stream bound to loop with a 64 KiB read buffer. |
function | ~Stream virtual inline | Destroy the stream, stopping reads and freeing pooled write requests. |
function | close virtual inline override | Closes and resets the stream handle. This will close the active socket/pipe and destroy the handle. |
function | shutdown inline | Send a TCP/pipe shutdown request to the connected peer. |
function | write inline | Write len bytes from data to the stream. |
function | writeOwned inline | Write an owned payload buffer to the stream. |
function | setHighWaterMark inline | Set the high water mark for the write queue (default 16MB). When the write queue exceeds this size, write() returns false. |
function | write inline | Write len bytes from data together with a stream handle over an IPC pipe (uses uv_write2). |
function | stream inline | Return the underlying uv_stream_t pointer cast from the native handle. |
variable | _buffer | |
variable | _started | |
variable | _highWaterMark | 16MB default write queue limit |
variable | _writeReqFree | Freelist for write requests. |
variable | _ownedWriteReqFree | Freelist for owned write requests. |
function | readStart virtual inline | Begin reading from the stream by registering libuv read callbacks. |
function | readStop virtual inline | Stop reading from the stream. |
function | onRead virtual inline | Called by handleRead when len bytes of data arrive. |
function | allocWriteReq inline | Return a uv_write_t from the freelist, or allocate a new one if the pool is empty. |
function | freeWriteReq inline | Return req to the freelist, or delete it if the pool is at capacity. |
function | allocOwnedWriteReq inline | |
function | freeOwnedWriteReq inline | |
function | canQueueWrite inline | |
typedef | Handle |
Inherited from Handle
| Kind | Name | Description |
|---|---|---|
function | Handle inline | Construct the handle bound to the given event loop. |
function | ~Handle virtual inline | |
function | init inline | Initialize the underlying libuv handle by calling f with the loop, the raw handle pointer, and any additional args. |
function | invoke inline | Invoke a libuv function f with args on the initialized handle. |
function | invokeOrThrow inline | Invoke a libuv function f with args, throwing on failure. |
function | close virtual inline | Close and destroy the handle. |
function | ref inline | Re-reference the handle with the event loop after a previous [unref()](icy-uv-Handle.html#unref). |
function | unref inline | Unreference the handle from the event loop. |
function | initialized const inline | Return true if the handle has been successfully initialized via [init()](icy-uv-Handle.html#init-8). |
function | active virtual const inline | Return true when the handle is active (libuv uv_is_active). |
function | closing virtual const inline | Return true if uv_close has been called and the handle is awaiting its close callback (libuv uv_is_closing). |
function | closed virtual const inline | Return true if the handle has been fully closed (context released). |
function | error const inline | Return the last error set on this handle, or a default-constructed [Error](icy-Error.html#error) if no error has occurred. |
function | setError virtual inline | Set the error state and invoke [onError()](icy-uv-Handle.html#onerror). |
function | setUVError inline | Translate a libuv error code into an [Error](icy-Error.html#error) and call [setError()](icy-uv-Handle.html#seterror-1). |
function | setAndThrowError inline | Set the error state from a libuv error code and throw a std::runtime_error. |
function | throwLastError inline | Throw a std::runtime_error if the handle currently holds an error. |
function | loop const inline | Return the event loop this handle is bound to. |
function | reset inline | Close the current handle (if open) and allocate a fresh [Context](icy-uv-Context.html#context-2), leaving the handle ready to be re-initialized via [init()](icy-uv-Handle.html#init-8). |
function | get const inline | Return the raw libuv handle pointer cast to [Handle](icy-uv-Handle.html#handle-6). |
function | tid const inline | Return the ID of the thread that constructed this handle. |
function | context const inline | Return the raw [Context](icy-uv-Context.html#context-2) that owns the libuv handle memory. |
function | setCloseCleanup inline | |
function | clearCloseCleanup inline | |
function | assertThread const inline | Throw std::logic_error if called from any thread other than the thread that constructed this handle. |
variable | _loop | |
variable | _context | |
variable | _tid | |
variable | _error | |
function | onError virtual inline | Called by [setError()](icy-uv-Handle.html#seterror-1) after the error state has been updated. |
function | onClose virtual inline | Called by [close()](icy-uv-Handle.html#close-18) after the context has been released. |
function | Handle | NonCopyable and NonMovable. |
function | operator= | Deleted assignment operator. |
function | Handle | Deleted constructor. |
function | operator= | Deleted assignment operator. |
typedef | Type | Define the native handle type. |
Inherited from Socket
| Kind | Name | Description |
|---|---|---|
variable | opaque | Optional client data. |
function | Socket | Defaulted constructor. |
function | ~Socket virtual noexcept | Defaulted destructor. |
function | Socket | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | Socket | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | connect virtual | Connects to the given peer IP address. |
function | connect virtual | Resolves and connects to the given host address. |
function | bind virtual | Bind a local address to the socket. The address may be IPv4 or IPv6 (if supported). |
function | listen virtual inline | Listens the socket on the given address. |
function | shutdown virtual inline | Sends the shutdown packet which should result is socket closure via callback. |
function | sendOwned virtual | Sends an owned payload buffer to the connected peer. |
function | sendOwned virtual | |
function | close virtual | Closes the underlying socket. |
function | address virtual const | The locally bound address. |
function | peerAddress virtual const | The connected peer address. |
function | transport virtual const | The transport protocol: TCP, UDP or SSLTCP. |
function | setError virtual | Sets the socket error. |
function | error virtual const | Return the socket error if any. |
function | closed virtual const | Returns true if the native socket handle is closed. |
function | loop virtual const | Returns the socket event loop. |
variable | _af | |
function | init virtual | Initializes the underlying socket context. |
function | reset virtual | Resets the socket context for reuse. |
typedef | Ptr | |
typedef | Vec |
Inherited from SocketAdapter
| Kind | Name | Description |
|---|---|---|
variable | priority | The priority of this adapter for STL sort operations. |
function | SocketAdapter | Creates the SocketAdapter. |
function | ~SocketAdapter virtual noexcept | Destroys the SocketAdapter. |
function | send virtual | Sends the given data buffer to the connected peer. Returns the number of bytes sent or -1 on error. No exception will be thrown. For TCP sockets the given peer address must match the connected peer address. |
function | send virtual | |
function | sendOwned virtual | Sends an owned payload buffer to the connected peer. |
function | sendOwned virtual | |
function | sendPacket virtual | Sends the given packet to the connected peer. Returns the number of bytes sent or -1 on error. No exception will be thrown. For TCP sockets the given peer address must match the connected peer address. |
function | sendPacket virtual | |
function | sendPacket virtual | Sends the given packet to the connected peer. This method provides delegate compatibility, and unlike other send methods throws an exception if the underlying socket is closed. |
function | setSender virtual | Sets the pointer to the outgoing data adapter. Send methods proxy data to this adapter by default. |
function | sender | Returns the output SocketAdapter pointer. |
function | addReceiver virtual | Sets the pointer to the incoming data adapter. Events proxy data to this adapter by default. |
function | removeReceiver virtual | Remove the given receiver. |
function | hasReceiver virtual | Returns true if the given receiver is connected. |
function | receivers | Returns all currently registered input SocketAdapter pointers. Dead (removed) entries are excluded from the returned list. |
function | onSocketConnect virtual | Called when the socket establishes a connection. Forwards the event to all registered receivers in priority order. Override to intercept before the application sees the event. |
function | onSocketRecv virtual | Called when data is received from the socket. Forwards the event to all registered receivers in priority order. |
function | onSocketError virtual | Called when the socket encounters an error. Forwards the event to all registered receivers in priority order. |
function | onSocketClose virtual | Called when the socket is closed. Forwards the event to all registered receivers in priority order. |
variable | _sender | |
variable | _receivers | |
variable | _dirty | |
function | cleanupReceivers virtual |
Public Attributes
| Return | Name | Description |
|---|---|---|
LocalSignal< void(const net::TCPSocket::Ptr &)> | AcceptConnection | Fired when a new client connection is accepted; carries a shared_ptr to the new socket. |
AcceptConnection
LocalSignal< void(const net::TCPSocket::Ptr &)> AcceptConnectionDefined in src/net/include/icy/net/tcpsocket.h:149
Fired when a new client connection is accepted; carries a shared_ptr to the new socket.
Public Methods
| Return | Name | Description |
|---|---|---|
TCPSocket | Constructs the TCPSocket and initializes the underlying libuv handle. | |
TCPSocket | Deleted constructor. | |
TCPSocket | Deleted constructor. | |
bool | shutdown virtual override | Sends a TCP shutdown request; the socket closes after the peer acknowledges. |
void | close virtual override | Closes the socket immediately, releasing all associated resources. |
void | connect virtual override | Connects to peerAddress using a libuv connect request. On success, calls onConnect(); on failure, calls setUVError(). |
void | connect virtual override | Resolves host via DNS (or maps "localhost"), then connects. |
ssize_t | send virtual override | Writes len bytes to the connected peer. |
ssize_t | sendOwned virtual override | Sends an owned payload buffer to the connected peer. |
ssize_t | send virtual override | Writes len bytes; peerAddress is ignored for TCP (connected stream). |
ssize_t | sendOwned virtual override | |
void | bind virtual override | Binds the socket to address. Resets and reinitializes the handle if the address family changes. |
void | listen virtual override | Starts listening for incoming connections with the given backlog. |
void | acceptConnection virtual | Accepts the next pending client connection and fires AcceptConnection. |
bool | setReusePort | Enables SO_REUSEPORT on Linux kernel >= 3.9 for multi-thread load balancing. Must be called after bind(). No-op and returns false on unsupported platforms. |
bool | setNoDelay | Enables or disables TCP_NODELAY (Nagle's algorithm). |
bool | setKeepAlive | Enables or disables TCP keep-alive probes. |
bool | setSimultaneousAccepts | Enables or disables simultaneous accepts on Windows. No-op and returns false on non-Windows platforms. |
void | setMode | Sets the socket mode (ServerSide or ClientSide). |
SocketMode | mode const | Returns the current socket mode. |
void | setError virtual override | Sets the socket error; ignores the call if an error is already recorded. Setting an error causes the socket to close. |
const icy::Error & | error virtual const override | Returns the current socket error, if any. |
bool | closed virtual const override | Returns true if the native socket handle is closed. |
net::Address | address virtual const override | Returns the IP address and port number of the socket. A wildcard address is returned if the socket is not connected. |
net::Address | peerAddress virtual const override | Returns the IP address and port number of the peer socket. A wildcard address is returned if the socket is not connected. |
net::TransportType | transport virtual const override | Returns the TCP transport protocol. |
uv::Loop * | loop virtual const override | Returns the event loop associated with this socket. |
void | onConnect virtual | Called by the stream layer when the TCP connection is established. |
void | onRead virtual override | Called by the stream layer with raw received bytes; wraps them in a MutableBuffer. |
void | onRecv virtual | Dispatches a received buffer to all socket adapters via onSocketRecv. |
void | onError virtual override | Dispatches the error to adapters and closes the socket. |
void | onClose virtual override | Dispatches the close event to all socket adapters. |
TCPSocket
TCPSocket(uv::Loop * loop = uv::defaultLoop())Defined in src/net/include/icy/net/tcpsocket.h:39
Constructs the TCPSocket and initializes the underlying libuv handle.
Parameters
loopEvent loop to use; defaults to the default loop.
TCPSocket
TCPSocket(const TCPSocket &) = deleteDefined in src/net/include/icy/net/tcpsocket.h:42
Deleted constructor.
TCPSocket
TCPSocket(TCPSocket &&) = deleteDefined in src/net/include/icy/net/tcpsocket.h:44
Deleted constructor.
shutdown
virtual override
virtual bool shutdown() overrideDefined in src/net/include/icy/net/tcpsocket.h:49
Sends a TCP shutdown request; the socket closes after the peer acknowledges.
Returns
true if the shutdown request was queued successfully.
Reimplements
close
virtual override
virtual void close() overrideDefined in src/net/include/icy/net/tcpsocket.h:52
Closes the socket immediately, releasing all associated resources.
Reimplements
Reimplemented by
connect
virtual override
virtual void connect(const net::Address & peerAddress) overrideDefined in src/net/include/icy/net/tcpsocket.h:57
Connects to peerAddress using a libuv connect request. On success, calls onConnect(); on failure, calls setUVError().
Parameters
peerAddressThe remote address to connect to.
Reimplements
Reimplemented by
connect
virtual override
virtual void connect(std::string_view host, uint16_t port) overrideDefined in src/net/include/icy/net/tcpsocket.h:62
Resolves host via DNS (or maps "localhost"), then connects.
Parameters
hostHostname or IP address string.portDestination port.
Reimplements
Reimplemented by
send
virtual override
virtual ssize_t send(const char * data, size_t len, int flags = 0) overrideDefined in src/net/include/icy/net/tcpsocket.h:69
Writes len bytes to the connected peer.
Parameters
dataPointer to the data to send.lenNumber of bytes to send.flagsReserved; currently unused.
Returns
Number of bytes sent, or -1 on error.
Reimplements
Reimplemented by
sendOwned
virtual override
virtual ssize_t sendOwned(Buffer && buffer, int flags = 0) overrideDefined in src/net/include/icy/net/tcpsocket.h:70
Sends an owned payload buffer to the connected peer.
Reimplements
Reimplemented by
send
virtual override
virtual ssize_t send(const char * data, size_t len, const net::Address & peerAddress, int flags = 0) overrideDefined in src/net/include/icy/net/tcpsocket.h:78
Writes len bytes; peerAddress is ignored for TCP (connected stream).
Parameters
dataPointer to the data to send.lenNumber of bytes to send.peerAddressIgnored; present for interface conformance.flagsReserved; currently unused.
Returns
Number of bytes sent, or -1 on error.
Reimplements
Reimplemented by
sendOwned
virtual override
virtual ssize_t sendOwned(Buffer && buffer, const net::Address & peerAddress, int flags = 0) overrideDefined in src/net/include/icy/net/tcpsocket.h:79
Reimplements
Reimplemented by
bind
virtual override
virtual void bind(const net::Address & address, unsigned flags = 0) overrideDefined in src/net/include/icy/net/tcpsocket.h:85
Binds the socket to address. Resets and reinitializes the handle if the address family changes.
Parameters
addressLocal address to bind to.flagsOptional bind flags (e.g. UV_TCP_IPV6ONLY is added automatically for IPv6).
Reimplements
Reimplemented by
listen
virtual override
virtual void listen(int backlog = 64) overrideDefined in src/net/include/icy/net/tcpsocket.h:89
Starts listening for incoming connections with the given backlog.
Parameters
backlogMaximum length of the pending connection queue.
Reimplements
Reimplemented by
acceptConnection
virtual
virtual void acceptConnection()Defined in src/net/include/icy/net/tcpsocket.h:92
Accepts the next pending client connection and fires AcceptConnection.
Reimplemented by
setReusePort
bool setReusePort()Defined in src/net/include/icy/net/tcpsocket.h:97
Enables SO_REUSEPORT on Linux kernel >= 3.9 for multi-thread load balancing. Must be called after bind(). No-op and returns false on unsupported platforms.
Returns
true if the socket option was set successfully.
setNoDelay
bool setNoDelay(bool enable)Defined in src/net/include/icy/net/tcpsocket.h:102
Enables or disables TCP_NODELAY (Nagle's algorithm).
Parameters
enabletrue to disable Nagle's algorithm (lower latency).
Returns
true if the option was set successfully.
setKeepAlive
bool setKeepAlive(bool enable, int delay)Defined in src/net/include/icy/net/tcpsocket.h:108
Enables or disables TCP keep-alive probes.
Parameters
enabletrue to enable keep-alive.delayInitial delay in seconds before the first keep-alive probe.
Returns
true if the option was set successfully.
setSimultaneousAccepts
bool setSimultaneousAccepts(bool enable)Defined in src/net/include/icy/net/tcpsocket.h:114
Enables or disables simultaneous accepts on Windows. No-op and returns false on non-Windows platforms.
Parameters
enabletrue to enable simultaneous accepts.
Returns
true if the option was set successfully.
setMode
void setMode(SocketMode mode)Defined in src/net/include/icy/net/tcpsocket.h:118
Sets the socket mode (ServerSide or ClientSide).
Parameters
modeThe mode to assign.
mode
const
SocketMode mode() constDefined in src/net/include/icy/net/tcpsocket.h:121
Returns the current socket mode.
setError
virtual override
virtual void setError(const icy::Error & err) overrideDefined in src/net/include/icy/net/tcpsocket.h:126
Sets the socket error; ignores the call if an error is already recorded. Setting an error causes the socket to close.
Parameters
errThe error to record.
Reimplements
error
virtual const override
virtual const icy::Error & error() const overrideDefined in src/net/include/icy/net/tcpsocket.h:129
Returns the current socket error, if any.
Reimplements
closed
virtual const override
virtual bool closed() const overrideDefined in src/net/include/icy/net/tcpsocket.h:132
Returns true if the native socket handle is closed.
Reimplements
address
virtual const override
virtual net::Address address() const overrideDefined in src/net/include/icy/net/tcpsocket.h:136
Returns the IP address and port number of the socket. A wildcard address is returned if the socket is not connected.
Reimplements
peerAddress
virtual const override
virtual net::Address peerAddress() const overrideDefined in src/net/include/icy/net/tcpsocket.h:140
Returns the IP address and port number of the peer socket. A wildcard address is returned if the socket is not connected.
Reimplements
transport
virtual const override
virtual net::TransportType transport() const overrideDefined in src/net/include/icy/net/tcpsocket.h:143
Returns the TCP transport protocol.
Reimplements
loop
virtual const override
virtual uv::Loop * loop() const overrideDefined in src/net/include/icy/net/tcpsocket.h:146
Returns the event loop associated with this socket.
Reimplements
onConnect
virtual
virtual void onConnect()Defined in src/net/include/icy/net/tcpsocket.h:153
Called by the stream layer when the TCP connection is established.
Reimplemented by
onRead
virtual override
virtual void onRead(const char * data, size_t len) overrideDefined in src/net/include/icy/net/tcpsocket.h:158
Called by the stream layer with raw received bytes; wraps them in a MutableBuffer.
Parameters
dataPointer to received bytes.lenNumber of bytes received.
Reimplements
Reimplemented by
onRecv
virtual
virtual void onRecv(const MutableBuffer & buf)Defined in src/net/include/icy/net/tcpsocket.h:162
Dispatches a received buffer to all socket adapters via onSocketRecv.
Parameters
bufThe buffer containing the received data.
onError
virtual override
virtual void onError(const icy::Error & error) overrideDefined in src/net/include/icy/net/tcpsocket.h:166
Dispatches the error to adapters and closes the socket.
Parameters
errorThe error that occurred.
Reimplements
onClose
virtual override
virtual void onClose() overrideDefined in src/net/include/icy/net/tcpsocket.h:169
Dispatches the close event to all socket adapters.
Reimplements
Protected Attributes
| Return | Name | Description |
|---|---|---|
SocketMode | _mode | |
net::Address | _peerAddress | Cached peer address (avoids syscall per recv) |
_mode
SocketMode _modeDefined in src/net/include/icy/net/tcpsocket.h:175
_peerAddress
net::Address _peerAddressDefined in src/net/include/icy/net/tcpsocket.h:176
Cached peer address (avoids syscall per recv)
Protected Methods
| Return | Name | Description |
|---|---|---|
void | init virtual override | Initializes the underlying socket context. |
void | reset virtual override | Resets the socket context for reuse. |
init
virtual override
virtual void init() overrideDefined in src/net/include/icy/net/tcpsocket.h:172
Initializes the underlying socket context.
Reimplements
reset
virtual override
virtual void reset() overrideDefined in src/net/include/icy/net/tcpsocket.h:173
Resets the socket context for reuse.
Reimplements
Public Types
Ptr
using Ptr = std::shared_ptr< TCPSocket >Defined in src/net/include/icy/net/tcpsocket.h:34
Vec
using Vec = std::vector< Ptr >