Name

socket, socket, kPMSocket — A description of a TCP/IP socket.

Synopsis

socket structure { unique ID, interface, port, protocol family, time out, service, SSL, Bonjour domains, options, URLs, state };
unique ID : string, default, length 1..255
interface : string, default
port : integer, default, optional, range 0..65536
protocol family : string, choice, default
time out : integer, default, optional, range 15..600
service : string, optional
SSL : SSL structure, optional
Bonjour domains : array of strings, optional, unique
options : array of socket options elements, optional, unique
URLs : array of strings, optional, unique
state : string, choice, default

Description

A description of a TCP/IP socket.

Fields

unique ID. Unique identifier.

unique ID must be unique within the immediate set of sockets. unique ID is used to identify a specific socket within a set and for reporting.

unique ID is a string. If unique ID is omitted, a default is created. unique ID must be between 1 and 255 characters long, inclusive.

interface. Bind to which interface (hostname).

interface is the hostname or IP address the socket binds to. An IP address is preferred as it avoids a domain name lookup. interface format must correspond to the protocol family.

To bind to the localhost with IPv4 use: '127.0.0.1'
To bind to the localhost with IPv6 use: '::1'

Sockets can bind to all available interfaces by setting Interface to an empty string.

interface is a string. If interface is omitted, the default "" is used.

port. port to accept incoming connections on.

port is an integer. If port is omitted, the default 0 is used. port is optional. port must be between 0 and 65536, inclusive.

protocol family. Network protocol to use.

To listen to both IPv4 and IPv6, create two sockets with a common port but listening to different protocols.

protocol family is a string. If protocol family is omitted, the default IPv4 is used. protocol family must be one of the following two constants:

  • IPv4, kPMSocketProtocolFamily_IPv4.
  • IPv6, kPMSocketProtocolFamily_IPv6.

time out. Seconds of silence before a connection times out.

time out is the number of seconds a silent connection should wait before automatically disconnecting. A period of silence occurs when no information is being sent or received.

time out is an integer. If time out is omitted, the default 30 is used. time out is optional. time out must be between 15 and 600, inclusive.

service. PAM service.

service is a string. service is optional.

SSL. SSL configuration.

SSL is a SSL structure. SSL is optional.

Bonjour domains. Bonjour domains.

Bonjour domains enumerates the domains in which services are published. A socket may be published in multiple domains. Where no domains are listed, the default domains are used. Where an empty list is used, Bonjour is disabled. Bonjour is also known as ZeroConf.

Bonjour domains is an array of strings. Bonjour domains is optional. Each item in Bonjour domains must be unique.

options. Socket options.

options is an array of socket options elements. options is optional. Each item in options must be unique.

URLs. URL to connect to this socket.

URLs is an array of strings. URLs is optional. Each item in URLs must be unique.

state. State of the socket.

state is a string. If state is omitted, the default preparing is used. state must be one of the following three constants:

  • preparing, kPMSocketState_Preparing.
  • listening, kPMSocketState_Listening.
  • error, kPMSocketState_Error.