inets(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– inets β€” the Erlang module, bestie πŸ’–

okay so real quick, the manual name is inets and it lives in section 3 (inets(3)) β€” it's an Erlang Module Definition, and it's about to be your new fave. sit down, hydrate, let's go 🫢


✨ NAME ✨

inets β€” The Inets services API. that's it, that's the name, iconic πŸ’…


🌸 DESCRIPTION 🌸

This module provides the most basic API to the clients and servers that are part of the Inets application, such as start and stop.

like, it's the bare-minimum entry point. starting things. stopping things. the foundations, fr fr.

πŸŽ€ Data types

Type definitions that are used more than once in this module:

service() = httpc | httpd

property() = atom()

πŸ¦‹ See also

httpc, httpd


🌈 DATA TYPES 🌈

inets_service() :: httpd | httpc.
service_info() ::
          {inets_service(),
           pid(),
           [{profile, atom()}] | no_such_service |
service_not_available}.

πŸ‘‘ FUNCTIONS πŸ‘‘

πŸ’œ service_names() -> [inets_service()].

Returns a list of available service names.

just the names, nothing more. a little roster of who's available. πŸ’–


πŸ’œ services() -> [{inets_service(), pid()}] | {error, inets_not_started}.

Returns a list of currently running services.

NOTE: Services started as stand_alone are not listed. so if you're looking for your standalone baby in here and you can't find it… yeah that's why, no cap 😭

πŸ’œ services_info() -> [service_info()] | {error, inets_not_started}.

Returns a list of currently running services where each service is described by an [{Option, Value}] list. The information in the list is specific for each service and each service has probably its own info function that gives more details about the service. If specific service info returns {error, Reason}, Info will contain Reason term.

so like, every service spills its own tea in its own format β€” go check each service's own info function for the deep lore. and if a service's info call fails, the Reason just gets tucked right into Info. πŸ“


πŸ’œ start(Type) -> ok | {error, Reason}

when
    Type :: application:restart_type(),
    Reason :: term().

Starts the Inets application. Default type is temporary. See also application.

yep, temporary is the default β€” that's the whole vibe unless you say otherwise. 🌟


πŸ’œ start(Service, ServiceConfig, How) -> Result

when
    Service :: inets_service(),
    ServiceConfig :: ConfPropList | ConfFile,
    How :: inets | stand_alone,
    ConfPropList :: [{Property, Value}],
    ConfFile :: string(),
    Property :: term(),
    Value :: term(),
    Result :: {ok, pid()} | {error, term()}.

Dynamically starts an Inets service after the Inets application has been started.

so first the Inets app has to already be up, and then you can spawn a service into it, main character energy ✨

NOTE: Dynamically started services are not handled by application takeover and failover behavior when Inets is run as a distributed application. Nor are they automatically restarted when the Inets application is restarted. As long as the Inets application is operational, they are supervised and can be soft code upgraded. A service started as stand_alone, that is, the service is not started as part of the Inets application, lose all OTP application benefits, such as soft upgrade. The stand_alone-service is linked to the process that started it. Usually some supervision functionality is still in place and in some sense the calling process becomes the top supervisor.

let me translate the drama: dynamically started services don't get the takeover/failover treatment when Inets is distributed, and they don't auto-restart when Inets restarts. while Inets is running though, they're supervised and can do soft code upgrades. but a stand_alone service β€” one that isn't part of the Inets application β€” loses all those OTP perks, soft upgrade included. it's linked to whoever started it, and usually there's still some supervision hanging around, and in some sense the calling process becomes the top supervisor. πŸ’€

Warning The stand_alone option is considered deprecated.

periodt. deprecated. don't build your whole personality on it. πŸ™ˆ


πŸ’œ stop() -> ok.

Stops the Inets application. See also application.

that's it, that's the function, it just says bye. πŸ‘‹


πŸ’œ stop(Service, Reference) -> ok | {error, Reason}

when
    Service :: inets_service() | stand_alone,
    Reference :: pid() | term(),
    Reason :: term().

Stops a started service of the Inets application or takes down a stand_alone-service gracefully. When option stand_alone is used in start, only the pid is a valid argument to stop.

so: graceful shutdown either way. but heads up β€” if you started it with stand_alone, the only thing you can hand to stop is the pid. nothing else. not a vibe, just the rules. 🧚


and that's the whole page, bestie!! this one's from Ericsson AB, it's inets 9.7.2, and you can find it at inets(3). go forth and start/stop responsibly πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΊ

πŸ“¦ where this page comes from