TcpSocketBase class
An IPv4 or IPv6 TCP socket.
- Use
import ThinkMeta.ConcurrentTasks.Windows.TcpSocket;- Namespace
ThinkMeta::ConcurrentTasks::Windows- Inherits
IpSocketBase
Syntax
template <IpVersionType _IpVersion, SocketType _BaseSocket> class TcpSocketBaseTemplate parameters
_IpVersionIpVersionType- The IP version:
IpVersion::V4orIpVersion::V6. _BaseSocketSocketType- The socket class built on:
Socket(blocking calls) orAsyncIo::AsyncSocket.
Remarks
Plain (Socket) or asynchronous (AsyncIo::AsyncSocket). Owns its socket like Socket.
See also
TcpSocket, AsyncIo::AsyncTcpSocket
Names
| Name | Description |
|---|---|
TcpSocket |
A plain (non-task-aware) TCP socket of the given version. |
TcpSocket4 |
Plain IPv4 TCP socket. |
TcpSocket6 |
Plain IPv6 TCP socket. |
Constructors
TcpSocketBase
Takes over other's socket; other is left without one.
Syntax
TcpSocketBase(TcpSocketBase&& other) noexcept;Parameters
otherTcpSocketBase&&- The object whose socket is taken over; it holds no socket afterwards.
Methods
operator=
Takes over other's socket; a socket this object already holds is closed first.
Syntax
TcpSocketBase& operator=(TcpSocketBase&& other) noexcept;Parameters
otherTcpSocketBase&&- The object whose socket is taken over; it holds no socket afterwards.
Return value
Type: TcpSocketBase&
This object.
Create
Creates a TCP socket of the version's address family.
Syntax
WinsockErrorCode Create(
WSAPROTOCOL_INFO* protocolInfo = nullptr,
GROUP g = 0,
DWORD flags = 0
) noexcept;Parameters
protocolInfoWSAPROTOCOL_INFO*- Optional
WSAPROTOCOL_INFOthat selects the provider;nullptrfor the default.Default:nullptr gGROUP- The socket group (
0for none, which is the usual value).Default:0 flagsDWORDWSA_FLAG_*flags, e.g.WSA_FLAG_OVERLAPPED(an asynchronous socket adds it itself).Default:0
Return value
Type: WinsockErrorCode
WinsockError::Success, or the WSA error of WSASocket; for an asynchronous socket also the error of the completion port association (see AsyncIo::AsyncSocket::Create).
Remarks
Parameters as WSASocket. Needs Socket::Startup. An asynchronous socket (AsyncIo::AsyncTcpSocket) is created overlapped and associated with the core's completion port, which needs AsyncIo::EnableAsyncIo.
See also
Types
SockAddr
The version's socket address type (sockaddr_in or sockaddr_in6).
Syntax
using SockAddr = typename _Traits::SockAddr;Generated from ThinkMeta.ConcurrentTasks.API @ 137ec1d (2026-10-17).