local-hostname-and-portPortable Socketsopen-connectionmake-passive-socketGoTo Top

make-passive-socket   port &key backlog interface reuse-address => passive-socket[Function]

Purpose
Create a passive socket that can accept connections.

Package   :portable-sockets

Module   :portable-sockets

Arguments and values

port     An integer or a string specifying the service port
backlog     An integer (default is 5)
interface     A 32-bit internet address or a string specifying a network interface on the local machine or nil
reuse-address     A generalized boolean (default is nil)
passive-socket     A passive socket

Returns
The new passive socket.

Description
An interface string can be either a host name, such as "localhost" or a “dotted” IP address, such as "127.0.0.1".

The value of backlog tells the operating system how many unprocessed connections can be held pending (connected but still awaiting an accept-connection).

See also
    accept-connection
    start-connection-server

Example
Create a passive socket, listening on port 5555:

  > (make-passive-socket 5555)
  #<passive socket waiting for connection at */5555>
  >

Note
The passive socket should be closed using close-passive-socket when the service is no longer needed in order to free up operating system resources.


The GBBopen Project


local-hostname-and-portPortable Socketsopen-connectionmake-passive-socketGoTo Top