View Source gen_nb_server behaviour (erldns v4.2.0)

Summary

Functions

Start server listening on IpAddr:Port

Types

state/0

-type state() :: term().

Callbacks

handle_call/3

-callback handle_call(Request :: term(), From :: {pid(), Tag :: term()}, State :: state()) ->
                         {reply, Reply :: term(), NewState :: state()} |
                         {reply, Reply :: term(), NewState :: state(), timeout() | hibernate} |
                         {noreply, NewState :: state()} |
                         {noreply, NewState :: state(), timeout() | hibernate} |
                         {stop, Reason :: term(), Reply :: term(), NewState :: state()} |
                         {stop, Reason :: term(), NewState :: state()}.

handle_cast/2

-callback handle_cast(Request :: term(), State :: state()) ->
                         {noreply, NewState :: state()} |
                         {noreply, NewState :: state(), timeout() | hibernate} |
                         {stop, Reason :: term(), NewState :: term()}.

handle_info/2

-callback handle_info(Info :: timeout | term(), State :: state()) ->
                         {noreply, NewState :: state()} |
                         {noreply, NewState :: state(), timeout() | hibernate} |
                         {stop, Reason :: term(), NewState :: state()}.

init/1

-callback init(term()) -> {ok, State :: state()}.

new_connection/2

-callback new_connection(Socket :: gen_tcp:socket(), State :: state()) ->
                            {ok, NewServerState :: state()} |
                            {stop, Reason :: term(), NewServerState :: state()}.

sock_opts/0

-callback sock_opts() -> [gen_tcp:listen_option()].

terminate/2

-callback terminate(Reason :: normal | shutdown | {shutdown, term()} | term(), State :: state()) -> term().

Functions

start_link(CallbackModule, IpAddr, Port, InitParams)

Start server listening on IpAddr:Port