All Manuals > LispWorks User Guide and Reference Manual > 32 The COMM Package

NextPrevUpTopContentsIndex

create-async-io-state-and-connected-tcp-socket

Function
Summary

Creates an async-io-state which attempts to make a TCP connection.

Package

comm

Signature

create-async-io-state-and-connected-tcp-socket collection host service callback &key read-timeout write-timeout user-info connect-timeout local-address local-port keepalive nodelay name queue-output => async-io-state

Arguments

collection

A wait-state-collection.

host

An integer or a string or an ipv6-address object.

service

A string or a fixnum.

callback

A function designator for a function of two arguments.

read-timeout

nil or a positive real.

write-timeout

nil or a positive real.

user-info

A Lisp object.

connect-timeout

nil or a positive real.

local-address

nil, an integer, a string or an ipv6-address object.

local-port

nil, a string or a fixnum.

keepalive

A generalized boolean.

nodelay

A generalized boolean.

queue-output

A boolean.

name

A Lisp object.

Values

async-io-state

An async-io-state.

Description

The function create-async-io-state-and-connected-tcp-socket creates an async-io-state which attempts to make a TCP connection to host on port service within connect-timeout seconds. host and service are interpreted as described in Specifying the target for connecting and binding a socket.

When the connection has been made, callback is called with arguments async-io-state and nil. Normally callback will start asynchronous I/O by calling async-io-state-read-buffer, async-io-state-write-buffer or async-io-state-read-with-checking. If no connection can be made, callback is called with async-io-state and a list of parameters suitable for calling error.

local-address and local-port are used to bind the local side of the socket to a particular address and/or port if non-nil.

keepalive and nodelay set the SO_KEEPALIVE and TCP_NODELAY in the socket. The default value of keepalive is nil. The default value of nodelay is t.

queue-output controls what happens if you try to perform a write operation on the state while another write operation is ongoing. When nil, this will cause an error. When non-nil, the second write operation is queued and actually executed later. The default value of queue-output is nil.

read-timeout, write-timeout and user-info are set in async-io-state.

The default value of name is a string "Connected TCP".

See also

create-async-io-state
accept-tcp-connections-creating-async-io-states
The Async-I/O-State API


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex