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
struct WinsockErrorRemarks
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
Names
| Name | Description |
|---|---|
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.
bindorWSARecv.
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.
AcceptExorConnectEx.
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
Failed
IsPending
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).