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

NextPrevUpTopContentsIndex

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

Function
Summary

Creates an async-io-state where the object is a connected UDP socket.

Package

comm

Signature

create-async-io-state-and-connected-udp-socket collection hostspec service &key queue-output name errorp ipv6 read-timeout write-timeout user-info local-address local-port => async-io-state

Arguments

collection

A wait-state-collection to associate with the result.

hostspec, service

Specify the socket address to connect to in the standard way.

ipv6

One of nil, t or the keyword :any.

errorp

A boolean.

local-address, local-port

Specify the local socket address in the standard way.

queue-output

A boolean.

read-timeout, write-timeout, user-info, name

See async-io-state for possible values.

Values

async-io-state

An async-io-state.

Description

The function create-async-io-state-and-connected-udp-socket creates a new UDP socket, connects it to the socket address specified by hostspec and service, optionally binds it if local-port or local-address are non-nil, and then creates and returns an async-io-state object that can be used to perform I/O operations on the socket. The I/O operations are done using async-io-state-receive-message and async-io-state-send-message.

hostspec and service are interpreted as described in Specifying the target for connecting and binding a socket.

local-address and local-port are also interpreted as described in Specifying the target for connecting and binding a socket. Both values can be nil.

Connecting the socket affects the destination of messages sent using the async-io-state, and also restricts the origin of received messages.

When ipv6 is :any, the system selects whether to use an IPv4 or IPv6 socket (normally it will be IPv4). When ipv6 is t it forces using IPv6, and nil forces IPv4. The default value of ipv6 is :any.

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

read-timeout, write-timeout, user-info and name set the corresponding values in async-io-state.

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

When errorp is nil, create-async-io-state-and-connected-udp-socket returns nil for runtime errors rather than signalling an error. The default value of errorp is t.

Notes
  1. If you need an unconnected socket, use create-async-io-state-and-udp-socket.
  2. The call to create-async-io-state-and-connected-udp-socket itself is synchronous.
  3. You cannot use async-io-state-send-message-to-address with the result of create-async-io-state-and-connected-udp-socket (because the socket address to send to is already specified by connecting.)
See also

async-io-state-receive-message
async-io-state-send-message
create-async-io-state-and-udp-socket
The Async-I/O-State API


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex