---
name: "httpd_socket"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/httpd_socket"
---

# httpd\_socket(3erl)

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

## NAME

httpd\_socket - Communication utility functions to be used by the Erlang\
     web server API programmer.

## DESCRIPTION

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*.

## EXPORTS

**deliver(SocketType, Socket, Data) -\> Result**\

Types:

SocketType = socket\_type()\
 Socket = socket()\
 Data = io\_list() \| binary()\
 Result = socket\_closed \| void()\

*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) -\> {Port,IPAddress}**\

Types:

SocketType = socket\_type()\
 Socket = socket()\
 Port = integer()\
 IPAddress = string()\

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

**resolve() -\> HostName**\

Types:

HostName = string()\

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

## SEE ALSO

[httpd(3erl)](/httpd/3erl.md)
