Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

195 lines (110 sloc) 4.724 kb

Module proc_socket_server

Keeps track of a number of TCP sessions.

This module will manage a collection of TCP sessions for the same
server.  If +Port+ is 0, the underlying OS assigns an available
port number.  If a +Name+ is not specified, the server will be
named +picoSocketServer_+ plus the TCP port number that the
service listens to, e.g. +picoSocketServer_9923+.
A managed server can be started, stopped, enumerate child
sessions, and limit the maximum number of child sessions.
The conventions used by this module look quite different than
OTP-based services, due to its origin.

.

Function Index

cold_start/7
server_children/1
server_children/2
server_port/1
server_port/2
server_status/1
server_status/2
start_child/3
start_raw_server/5
start_raw_server/7
start_server/3

Start a new UBF contract-using server.

  • This server accepts up to Max connections on TCP port Port.

  • SpawnOpts are the erlang garbage collection options for the spawned process.

  • Each time a new connection is made, Fun(Socket) is called.

    ------
    Fun = fun(Socket) -> exit(normal) | exit(socket_closed) |
                         exit({socket_error, Reason}) | exit(timeout).
    ------
    Fun will handle all of the protocol communication for a single TCP
    session.
    A raw server uses packet length 0 (see start_raw_server/5 and
    start_raw_server/7).
.
start_server/4
stop_server/1

Function Details

cold_start/7

cold_start(Parent, Name, Port, Max, Fun, PacketType, PacketSize) -> any()

server_children/1

server_children(Name) -> any()

server_children/2

server_children(Pid, Timeout) -> any()

server_port/1

server_port(Name) -> any()

server_port/2

server_port(Pid, Timeout) -> any()

server_status/1

server_status(Name) -> any()

server_status/2

server_status(Pid, Timeout) -> any()

start_child/3

start_child(Parent, Listen, Fun) -> any()

start_raw_server/5

start_raw_server(Port, Max, Fun, PacketType, PacketSize) -> any()

start_raw_server/7

start_raw_server(Name, Port, Max, SpawnOpts, Fun, PacketType, PacketSize) -> any()

start_server/3

start_server(Port, Max, Fun) -> any()

Start a new UBF contract-using server.

  • This server accepts up to Max connections on TCP port Port.

  • SpawnOpts are the erlang garbage collection options for the spawned process.

  • Each time a new connection is made, Fun(Socket) is called.

    ------
    Fun = fun(Socket) -> exit(normal) | exit(socket_closed) |
                         exit({socket_error, Reason}) | exit(timeout).
    ------
    Fun will handle all of the protocol communication for a single TCP
    session.
    A raw server uses packet length 0 (see start_raw_server/5 and
    start_raw_server/7).

start_server/4

start_server(Name, Port, Max, Fun) -> any()

stop_server/1

stop_server(Pid) -> any()

Jump to Line
Something went wrong with that request. Please try again.