chickadee » socket » socket-type

socketrecord
socket family type #!optional (protocol 0)procedure
socket? soprocedure
socket-fileno soprocedure
socket-family soprocedure
socket-type soprocedure
socket-protocol soprocedure

Socket objects. You construct a socket using the socket procedure, passing an address family af/* constant for family (IPv4, IPv6) and a socket type sock/* constant for socket type (TCP, UDP). protocol should almost always be zero, unless you are creating raw sockets; it is implicit in the socket type. Sockets take up a file descriptor in the system until closed, which may or may not happen automatically on error. All sockets are created in non-blocking mode.

Accessors:

socket-fileno
The socket's file descriptor.
socket-family
The socket family, an integer constant.
socket-type
The socket type, an integer constant.
socket-protocol
The socket protocol, an integer constant.

Note that sockets are also implicitly created by socket-connect/ai and socket-accept.

Example:

(socket af/inet sock/stream)
  ; => #<socket fd:19 af/inet sock/stream>
(socket af/inet6 sock/dgram)
  ; => #<socket fd:20 af/inet6 sock/dgram>