Preliminary. ThinkMeta ConcurrentTasks and this documentation are preliminary; everything is subject to change.

API reference / Windows

WinsockError struct

Named Winsock error codes and helpers that turn Winsock return values into error codes.

Use
import ThinkMeta.ConcurrentTasks.Windows.WinsockError;
Namespace
ThinkMeta::ConcurrentTasks::Windows

Syntax

Remarks

A WinsockErrorCode is Success (0) or the WSAGetLastError value. WSAGetLastError is thread-local and equal to GetLastError, so the helpers must run right after the failing call on the same thread. For completed overlapped operations the socket classes use the completion's own code instead.

See also

WinsockErrorException

Names

NameDescription
WinsockErrorCode A Winsock error code as returned by the socket classes (0 = WinsockError::Success).

Methods

GetError

The error of a call returning 0 on success.

Syntax

static Type GetError(int result) noexcept;

Parameters

resultint
The result of e.g. bind or WSARecv.

Return value

Type: Type

Success, or WSAGetLastError for any other result.

GetAsyncError

The error of a call returning BOOL.

Syntax

static Type GetAsyncError(BOOL result) noexcept;

Parameters

resultBOOL
The result of e.g. AcceptEx or ConnectEx.

Return value

Type: Type

Success if TRUE, else WSAGetLastError.

GetLastError

The calling thread's last Winsock error (WSAGetLastError).

Syntax

static Type GetLastError() noexcept;

Return value

Type: Type

The last error code; only meaningful right after a failed Winsock call on this thread.

Succeeded

true for Success.

Syntax

static bool Succeeded(const Type& error) noexcept;

Parameters

errorconst Type&
The error code to test.

Return value

Type: bool

true if error is Success (0); otherwise false.

See also

Failed

Failed

true for anything but Success, including Pending.

Syntax

static bool Failed(const Type& error) noexcept;

Parameters

errorconst Type&
The error code to test.

Return value

Type: bool

true if error is not Success; otherwise false.

See also

Succeeded, IsPending

IsPending

true for Pending: an overlapped operation is in flight.

Syntax

static bool IsPending(const Type& error) noexcept;

Parameters

errorconst Type&
The error code to test.

Return value

Type: bool

true if error is Pending (WSA_IO_PENDING); otherwise false.

Types

Type

The underlying error type: int, as WSAGetLastError.

Syntax

using Type = int;

Fields

Success

Syntax

static constexpr Type Success = 0;

NotInitialized

Syntax

static constexpr Type NotInitialized = WSANOTINITIALISED;

BadDescriptor

Syntax

static constexpr Type BadDescriptor = WSAEBADF;

InvalidParameter

Syntax

static constexpr Type InvalidParameter = WSAEINVAL;

TooManyOpenFiles

Syntax

static constexpr Type TooManyOpenFiles = WSAEMFILE;

WouldBlock

Syntax

static constexpr Type WouldBlock = WSAEWOULDBLOCK;

InProgress

Syntax

static constexpr Type InProgress = WSAEINPROGRESS;

AlreadyInProgress

Syntax

static constexpr Type AlreadyInProgress = WSAEALREADY;

NotSocket

Syntax

static constexpr Type NotSocket = WSAENOTSOCK;

MessageSize

Syntax

static constexpr Type MessageSize = WSAEMSGSIZE;

ProtocolType

Syntax

static constexpr Type ProtocolType = WSAEPROTOTYPE;

ProtocolOption

Syntax

static constexpr Type ProtocolOption = WSAENOPROTOOPT;

OperationNotSupported

Syntax

static constexpr Type OperationNotSupported = WSAEOPNOTSUPP;

AddressFamilyNotSupported

Syntax

static constexpr Type AddressFamilyNotSupported = WSAEAFNOSUPPORT;

AddressInUse

Syntax

static constexpr Type AddressInUse = WSAEADDRINUSE;

AddressNotAvailable

Syntax

static constexpr Type AddressNotAvailable = WSAEADDRNOTAVAIL;

Pending

WSA_IO_PENDING: an overlapped operation was started and completes later.

Syntax

static constexpr Type Pending = WSA_IO_PENDING;

Incomplete

WSA_IO_INCOMPLETE: the operation is still pending.

Syntax

static constexpr Type Incomplete = WSA_IO_INCOMPLETE;

Remarks

Returned by GetOverlappedResult without wait.

InvalidHandle

Syntax

static constexpr Type InvalidHandle = WSA_INVALID_HANDLE;

InvalidParameterW

WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER).

Syntax

static constexpr Type InvalidParameterW = WSA_INVALID_PARAMETER;

Remarks

Not the same value as InvalidParameter (WSAEINVAL).

NotEnoughMemory

Syntax

static constexpr Type NotEnoughMemory = WSA_NOT_ENOUGH_MEMORY;

OperationAborted

WSA_OPERATION_ABORTED: the operation was cancelled or its socket closed.

Syntax

static constexpr Type OperationAborted = WSA_OPERATION_ABORTED;

TimedOut

WSAETIMEDOUT: the operation timed out.

Syntax

static constexpr Type TimedOut = WSAETIMEDOUT;

Remarks

Also returned by the AsyncIo::AsyncSocket waiting forms when their timeout expired.

Generated from ThinkMeta.ConcurrentTasks.API @ 137ec1d (2026-10-17).