NET_Status(3type)
π NET_Status β the tri-state bestie for async stuff π
ok so this is a page from the SDL_net3 DATATYPES manual, and the star of the show is NET_Status. it's a lil enum, it's iconic, it's giving "did it work tho?" energy. let's get into it β¨
πΈ NAME πΈ
NET_Status β a tri-state for asynchronous operations. three states, no cap. π
β¨ SYNOPSIS β¨
#include <SDL3_net/SDL_net.h>
typedef enum NET_Status
{
NET_FAILURE = -1, /**< Async operation complete, result was failure. */
NET_WAITING = 0, /**< Async operation is still in progress, check again later. */
NET_SUCCESS = 1 /**< Async operation complete, result was success. */
} NET_Status;
look at that enum. immaculate. the comments are even in there, we do not touch those, they are part of the vibe. π
π¦ DESCRIPTION π¦
ok so bestie, here's the tea: a LOT of stuff in SDL_net is asynchronous. like, it literally cannot finish until data travels across a network at some mysterious murky point in the future. we don't know when. nobody knows when. it's giving ~the unknown~ π«οΈ
this includes:
- sending data over a stream socket π¨
- resolving a hostname π
- connecting to a remote system π
- and other tasks, iykyk
the library never blocks on tasks that take time to complete. like, never. with ONE exception: functions named Wait, which exist purely to do nothing but block until a task completes. that's literally their whole job. main character energy but make it "I will sit here and wait." π
and here's the slay part: functions that are attempting to do something that might block, or that are querying the status of a task that's already in-progress, will return a NET_Status. so your app can peek and go "oh! it finished!" and also "oh! here's how it went." π«Ά
so real quick, the three states:
NET_FAILURE= -1 β async operation complete, and the result was a failure. it did NOT eat. πNET_WAITING= 0 β async operation is still in progress, so check again later. she's still cooking. πNET_SUCCESS= 1 β async operation complete, and the result was a success. ATE. no crumbs. π₯
ngl the whole point is: you poll, you vibe check the status, you keep it moving. never block unless you chose to call a Wait function. periodt.
π AVAILABILITY π
this enum has been available since SDL_net 3.0.0. she's been here. she's a veteran. π
and that's the whole page bestie, ty for reading, stan NET_Status, mwah π
this was brought to you by the SDL_net manual, version SDL_net 3.2.0 β go forth and check your statuses, queen β¨π π¦
π¦ where this page comes from
- fedora 43: SDL3_net-devel 3.2.0-2.fc43 Β· Zlib
- fedora 43: SDL3_net-devel 3.2.0-2.fc43 Β· Zlib
- fedora 44: SDL3_net-devel 3.2.0-2.fc44 Β· Zlib
- fedora 44: SDL3_net-devel 3.2.0-2.fc44 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms