ct_gen_conn

Generic connection owner process.

Generic connection owner process.

DATA TYPES

handle() = pid()

A handle for using a connection implemented with ct_gen_conn.erl.

Functions


start(Name, Address, InitData, CallbackMod) -> {ok, Handle} | {error, Reason}

  • Name = term()
  • CallbackMod = atom()
  • InitData = term()
  • Address = term()

Open a connection and start the generic connection owner process.

The CallbackMod is a specific callback module for each type of connection (e.g. telnet, ftp,...). It must export the function init/3 which takes the arguments Name, Addresse) and InitData and returna {ok,ConnectionPid,State} or {error,Reason}.

stop(Pid::Handle) -> ok

  • Handle = handle()

Close the telnet connection and stop the process managing it.

do_within_time(Fun, Timeout) -> FunResult | {error, Reason}

  • Fun = function()
  • Timeout = integer()

Execute a function within a limited time (tool-internal use only).

Execute the given Fun, but interrupt if it takes more than Timeout milliseconds.

The execution is also interrupted if the connection is closed.

call(Pid, Msg) -> term()