httpd_socket — inets v9.3.1

Search documentation of inets

# View Source httpd_socket (inets v9.3.1)

Communication utility functions to be used by the Erlang web server API programmer.

This module provides the Erlang web server API module programmer with utility functions for generic sockets communication. The appropriate communication mechanism is transparently used, that is, `ip_comm` or `ssl`.

### See also

`httpd`

# Summary

## Functions

deliver(SocketType, Socket, Data)

`deliver/3` sends `Data` over `Socket` using the specified `SocketType`. `Socket` and `SocketType` is to be the socket and the `socket_type` form the `mod` record as defined in `httpd.hrl`

peername(SocketType, Socket)

`peername/2` returns the `Port` and `IPAddress` of the remote `Socket`.

resolve()

`resolve/0` returns the official `HostName` of the current host.

# Functions

Link to this function

# deliver(SocketType, Socket, Data)

View Source

    -spec 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`. `Socket` and `SocketType` is to be the socket and the `socket_type` form the `mod` record as defined in `httpd.hrl`

Link to this function

# peername(SocketType, Socket)

View Source

    -spec 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`.

Link to this function

# resolve()

View Source

    -spec resolve() -> HostName when HostName :: inet:hostname().

`resolve/0` returns the official `HostName` of the current host.