httpd_socket(3)

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

πŸ’– httpd_socket β€” the Erlang Module Definition, bestie πŸ’–

okay so this is httpd_socket(3), a page from the Erlang manual set, and it's literally just the communication utility functions that you, the Erlang web server API programmer, get to use. group chat for sockets, basically. 🫢


🌸 NAME 🌸

httpd_socket β€” communication utility functions to be used by the Erlang web server API programmer.


✨ DESCRIPTION ✨

So here's the vibe: this module hands the Erlang web server API module programmer a whole lil toolkit of utility functions for generic sockets communication. The way it works is that the appropriate communication mechanism gets used transparently β€” like, you don't have to think about it, it just picks the right one for you. And the two options are ip_comm or ssl. slay. πŸ’…

See also β€” httpd


πŸ”₯ FUNCTIONS πŸ”₯

deliver(SocketType, Socket, Data) -> Result

when
    SocketType :: httpd:socket_type(),
    Socket :: inet:socket(),
    Data :: iolist() | binary(),
    Result :: ok | socket_closed.

deliver/3 sends Data over Socket using the specified SocketType. ✨

ngl the important bit here is: the Socket and SocketType you pass in are supposed to be the socket and the socket_type from the mod record as defined in httpd.hrl. like, that's the assignment, don't improvise. 😭


peername(SocketType, Socket) -> {Port, IpAdress}

when
    SocketType :: httpd:socket_type(),
    Socket :: inet:socket() | ssl:sslsocket(),
    Port :: inet:port_number(),
    IpAdress ::
        inet:ip4_address() |
        inet:ip6_address() |
        string().

peername/2 returns the Port and IPAddress of the remote Socket. that's it, that's the whole function, and it ate. πŸ‘‘


resolve() -> HostName

when HostName :: inet:hostname().

resolve/0 returns the official HostName of the current host. main character energy fr fr. 🌈

heads up bestie: yes, the original spells it IpAdress in that one spot. we do not fix what is iconic. periodt. πŸ’€

πŸŽ€ SEE ALSO πŸŽ€

  • httpd

and that's the whole page!! written by Ericsson AB, from inets 9.7.2, and it's giving httpd_socket(3) energy from start to finish. bye bestie, go deliver some data πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from