parent
75989895b0
commit
f114fc3b6a
|
@ -0,0 +1,22 @@
|
|||
# The following variables will be defined:
|
||||
#
|
||||
# ASIO_ROOT
|
||||
# ASIO_INCLUDE_DIR
|
||||
# ASIO_DEFINES
|
||||
#
|
||||
# No ASIO_LIBRARIES because it's header only library.
|
||||
#
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Find ASIO header directory
|
||||
# ============================================================================
|
||||
|
||||
set (ASIO_ROOT ${PROJECT_SOURCE_DIR}/src/libs/asio)
|
||||
set (ASIO_INCLUDE_DIR ${ASIO_ROOT}/include)
|
||||
|
||||
# ============================================================================
|
||||
# Add definitions
|
||||
# ============================================================================
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
@ -0,0 +1,5 @@
|
|||
See doc/index.html for information on:
|
||||
- External dependencies
|
||||
- Using asio
|
||||
- Supported platforms
|
||||
- How to build the tests and examples
|
|
@ -0,0 +1,23 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,19 @@
|
|||
AUTOMAKE_OPTIONS = foreign dist-bzip2 dist-zip
|
||||
|
||||
SUBDIRS = include src
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
$(srcdir)/aclocal.m4 \
|
||||
$(srcdir)/configure \
|
||||
$(srcdir)/config.guess \
|
||||
$(srcdir)/config.sub \
|
||||
$(srcdir)/depcomp \
|
||||
$(srcdir)/install-sh \
|
||||
$(srcdir)/missing \
|
||||
$(srcdir)/mkinstalldirs \
|
||||
$(srcdir)/Makefile.in \
|
||||
asio-*.tar.gz
|
||||
|
||||
EXTRA_DIST = \
|
||||
LICENSE_1_0.txt \
|
||||
doc
|
|
@ -0,0 +1,766 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) COPYING INSTALL \
|
||||
README compile config.guess config.sub depcomp install-sh \
|
||||
missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).zip
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-bzip2 dist-gzip dist-zip
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign dist-bzip2 dist-zip
|
||||
SUBDIRS = include src
|
||||
MAINTAINERCLEANFILES = \
|
||||
$(srcdir)/aclocal.m4 \
|
||||
$(srcdir)/configure \
|
||||
$(srcdir)/config.guess \
|
||||
$(srcdir)/config.sub \
|
||||
$(srcdir)/depcomp \
|
||||
$(srcdir)/install-sh \
|
||||
$(srcdir)/missing \
|
||||
$(srcdir)/mkinstalldirs \
|
||||
$(srcdir)/Makefile.in \
|
||||
asio-*.tar.gz
|
||||
|
||||
EXTRA_DIST = \
|
||||
LICENSE_1_0.txt \
|
||||
doc
|
||||
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscope: cscope.files
|
||||
test ! -s cscope.files \
|
||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
||||
clean-cscope:
|
||||
-rm -f cscope.files
|
||||
cscope.files: clean-cscope cscopelist
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist dist-all:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__post_remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(am__recursive_targets) install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am tags tags-am uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,4 @@
|
|||
asio version 1.10.6
|
||||
Released Tuesday, 24 March 2015.
|
||||
|
||||
See doc/index.html for API documentation and a tutorial.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,343 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-03-05.13; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
|
||||
# Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,265 @@
|
|||
AC_INIT(asio, [1.10.6])
|
||||
AC_CONFIG_SRCDIR(include/asio.hpp)
|
||||
AM_MAINTAINER_MODE
|
||||
AM_INIT_AUTOMAKE([tar-ustar])
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
AC_LANG(C++)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_DEFINE(_REENTRANT, [1], [Define this])
|
||||
|
||||
AC_ARG_WITH(boost,
|
||||
AC_HELP_STRING([--with-boost=DIR],[location of boost distribution]),
|
||||
[
|
||||
if test "${withval}" = no; then
|
||||
STANDALONE="yes"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I${withval}"
|
||||
LIBS="$LIBS -L${withval}/stage/lib"
|
||||
fi
|
||||
],
|
||||
[
|
||||
BOOSTDIR="`pwd`/../boost_1_55_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
LIBS="$LIBS -L${BOOSTDIR}/stage/lib"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_54_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
LIBS="$LIBS -L${BOOSTDIR}/stage/lib"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_53_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_52_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_51_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_50_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_49_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_48_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_47_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_46_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_46_1"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_45_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_44_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_43_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_42_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_41_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_40_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_39_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_38_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_37_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_36_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_35_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_34_1"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_34_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_33_1"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
else
|
||||
BOOSTDIR="`pwd`/../boost_1_33_0"
|
||||
if test -d "${BOOSTDIR}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(separate-compilation,
|
||||
[ --enable-separate-compilation separate compilation of asio source],
|
||||
[
|
||||
SEPARATE_COMPILATION=yes
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(boost-coroutine,
|
||||
[ --enable-boost-coroutine use Boost.Coroutine to implement stackful coroutines],
|
||||
[
|
||||
HAVE_BOOST_COROUTINE=yes
|
||||
])
|
||||
|
||||
if test "$STANDALONE" != yes; then
|
||||
AC_CHECK_HEADER([boost/noncopyable.hpp],,
|
||||
[
|
||||
echo "Can't find boost headers. Please check the location of the boost"
|
||||
echo "distribution and rerun configure using the --with-boost=DIR option."
|
||||
exit 1
|
||||
],[])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(openssl,
|
||||
AC_HELP_STRING([--with-openssl=DIR],[location of openssl]),
|
||||
[
|
||||
CPPFLAGS="$CPPFLAGS -I${withval}"
|
||||
],[])
|
||||
|
||||
AC_CHECK_HEADER([openssl/ssl.h],,
|
||||
[
|
||||
OPENSSL_FOUND=no
|
||||
],[])
|
||||
|
||||
if test x$OPENSSL_FOUND != xno; then
|
||||
LIBS="$LIBS -lssl -lcrypto"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(HAVE_OPENSSL,test x$OPENSSL_FOUND != xno)
|
||||
|
||||
WINDOWS=no
|
||||
case $host in
|
||||
*-*-linux*)
|
||||
CXXFLAGS="$CXXFLAGS -pthread"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
;;
|
||||
*-*-solaris*)
|
||||
if test "$GXX" = yes; then
|
||||
CXXFLAGS="$CXXFLAGS -D_PTHREADS"
|
||||
else
|
||||
# We'll assume Sun's CC.
|
||||
CXXFLAGS="$CXXFLAGS -mt"
|
||||
fi
|
||||
LIBS="$LIBS -lsocket -lnsl -lpthread"
|
||||
;;
|
||||
*-*-mingw32*)
|
||||
CXXFLAGS="$CXXFLAGS -mthreads"
|
||||
LDFLAGS="$LDFLAGS -mthreads"
|
||||
LIBS="$LIBS -lws2_32 -lmswsock"
|
||||
WINDOWS=yes
|
||||
;;
|
||||
*-pc-cygwin*)
|
||||
CXXFLAGS="$CXXFLAGS -D__USE_W32_SOCKETS -D_WIN32_WINNT=0x0501"
|
||||
LIBS="$LIBS -lws2_32 -lmswsock"
|
||||
WINDOWS=yes
|
||||
;;
|
||||
*-apple-darwin*)
|
||||
CXXFLAGS="$CXXFLAGS"
|
||||
LDFLAGS="$LDFLAGS"
|
||||
;;
|
||||
*-*-freebsd*)
|
||||
CXXFLAGS="$CXXFLAGS -pthread"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
CXXFLAGS="$CXXFLAGS -pthread"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$GXX" = yes; then
|
||||
CXXFLAGS="$CXXFLAGS -ftemplate-depth-256"
|
||||
if test "$STANDALONE" = yes; then
|
||||
CPPFLAGS="-std=c++0x $CPPFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$STANDALONE" = yes; then
|
||||
CPPFLAGS="$CPPFLAGS -DASIO_STANDALONE"
|
||||
fi
|
||||
|
||||
if test "$SEPARATE_COMPILATION" = yes; then
|
||||
CPPFLAGS="$CPPFLAGS -DASIO_SEPARATE_COMPILATION"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(STANDALONE,test x$STANDALONE = xyes)
|
||||
|
||||
AM_CONDITIONAL(SEPARATE_COMPILATION,test x$SEPARATE_COMPILATION = xyes)
|
||||
|
||||
AM_CONDITIONAL(HAVE_BOOST_COROUTINE,test x$HAVE_BOOST_COROUTINE = xyes)
|
||||
|
||||
AM_CONDITIONAL(WINDOWS_TARGET,test x$WINDOWS != xno)
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
include/Makefile
|
||||
src/Makefile
|
||||
src/tests/Makefile
|
||||
src/examples/cpp03/Makefile
|
||||
src/examples/cpp11/Makefile])
|
|
@ -0,0 +1,708 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2012-03-27.16; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
|
||||
# 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' "$nl" < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
|
||||
# However on
|
||||
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\':
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
# tcc 0.9.26 (FIXME still under development at the moment of writing)
|
||||
# will emit a similar output, but also prepend the continuation lines
|
||||
# with horizontal tabulation characters.
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form 'foo.o: dependent.h',
|
||||
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
|
||||
< "$tmpdepfile" > "$depfile"
|
||||
sed '
|
||||
s/[ '"$tab"'][ '"$tab"']*/ /g
|
||||
s/^ *//
|
||||
s/ *\\*$//
|
||||
s/^[^:]*: *//
|
||||
/^$/d
|
||||
/:$/d
|
||||
s/$/ :/
|
||||
' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test "$stat" = 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -0,0 +1,51 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Examples</title>
|
||||
<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../index.html" title="Asio">
|
||||
<link rel="up" href="../index.html" title="Asio">
|
||||
<link rel="prev" href="tutorial/boost_bind.html" title="boost::bind">
|
||||
<link rel="next" href="examples/cpp03_examples.html" title="C++03 Examples">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="tutorial/boost_bind.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="examples/cpp03_examples.html"><img src="../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="asio.examples"></a><a class="link" href="examples.html" title="Examples">Examples</a>
|
||||
</h2></div></div></div>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a class="link" href="examples/cpp03_examples.html" title="C++03 Examples">C++03 Examples</a>: Illustrates
|
||||
the use of Asio using only C++03 language and library features. Where necessary,
|
||||
the examples make use of selected Boost C++ libraries.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="examples/cpp11_examples.html" title="C++11 Examples">C++11 Examples</a>: Contains
|
||||
a limited set of the C++03 Asio examples, updated to use only C++11 library
|
||||
and language facilities. These examples do not make direct use of Boost
|
||||
C++ libraries. To show the changes between C++03 and C++11, these examples
|
||||
include a diff between the C++03 and C++11 versions.
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="tutorial/boost_bind.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="examples/cpp03_examples.html"><img src="../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,634 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>C++03 Examples</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="../examples.html" title="Examples">
|
||||
<link rel="next" href="cpp11_examples.html" title="C++11 Examples">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp11_examples.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.examples.cpp03_examples"></a><a class="link" href="cpp03_examples.html" title="C++03 Examples">C++03 Examples</a>
|
||||
</h3></div></div></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h0"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.allocation"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.allocation">Allocation</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example shows how to customise the allocation of memory associated with
|
||||
asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/allocation/server.cpp" target="_top">../src/examples/cpp03/allocation/server.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h1"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.buffers"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.buffers">Buffers</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example demonstrates how to create reference counted buffers that can
|
||||
be used with socket read and write operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/buffers/reference_counted.cpp" target="_top">../src/examples/cpp03/buffers/reference_counted.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h2"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.chat"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.chat">Chat</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example implements a chat server and client. The programs use a custom
|
||||
protocol with a fixed length message header and variable length message body.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/chat/chat_message.hpp" target="_top">../src/examples/cpp03/chat/chat_message.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/chat/chat_client.cpp" target="_top">../src/examples/cpp03/chat/chat_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/chat/chat_server.cpp" target="_top">../src/examples/cpp03/chat/chat_server.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The following POSIX-specific chat client demonstrates how to use the <a class="link" href="../reference/posix__stream_descriptor.html" title="posix::stream_descriptor">posix::stream_descriptor</a>
|
||||
class to perform console input and output.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/chat/posix_chat_client.cpp" target="_top">../src/examples/cpp03/chat/posix_chat_client.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h3"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.echo"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.echo">Echo</a>
|
||||
</h5>
|
||||
<p>
|
||||
A collection of simple clients and servers, showing the use of both synchronous
|
||||
and asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/echo/async_tcp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/async_tcp_echo_server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/echo/async_udp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/async_udp_echo_server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/echo/blocking_tcp_echo_client.cpp" target="_top">../src/examples/cpp03/echo/blocking_tcp_echo_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/echo/blocking_tcp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/blocking_tcp_echo_server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/echo/blocking_udp_echo_client.cpp" target="_top">../src/examples/cpp03/echo/blocking_udp_echo_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/echo/blocking_udp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/blocking_udp_echo_server.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h4"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.fork"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.fork">Fork</a>
|
||||
</h5>
|
||||
<p>
|
||||
These POSIX-specific examples show how to use Asio in conjunction with the
|
||||
<code class="computeroutput"><span class="identifier">fork</span><span class="special">()</span></code>
|
||||
system call. The first example illustrates the steps required to start a
|
||||
daemon process:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/fork/daemon.cpp" target="_top">../src/examples/cpp03/fork/daemon.cpp</a>
|
||||
</li></ul></div>
|
||||
<p>
|
||||
The second example demonstrates how it is possible to fork a process from
|
||||
within a completion handler.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/fork/process_per_connection.cpp" target="_top">../src/examples/cpp03/fork/process_per_connection.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h5"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.http_client"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_client">HTTP
|
||||
Client</a>
|
||||
</h5>
|
||||
<p>
|
||||
Example programs implementing simple HTTP 1.0 clients. These examples show
|
||||
how to use the <a class="link" href="../reference/read_until.html" title="read_until">read_until</a>
|
||||
and <a class="link" href="../reference/async_read_until.html" title="async_read_until">async_read_until</a>
|
||||
functions.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/client/sync_client.cpp" target="_top">../src/examples/cpp03/http/client/sync_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/client/async_client.cpp" target="_top">../src/examples/cpp03/http/client/async_client.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h6"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.http_server"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server">HTTP
|
||||
Server</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example illustrates the use of asio in a simple single-threaded server
|
||||
implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown
|
||||
by cancelling all outstanding asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/connection.cpp" target="_top">../src/examples/cpp03/http/server/connection.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/connection.hpp" target="_top">../src/examples/cpp03/http/server/connection.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/connection_manager.cpp" target="_top">../src/examples/cpp03/http/server/connection_manager.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/connection_manager.hpp" target="_top">../src/examples/cpp03/http/server/connection_manager.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/header.hpp" target="_top">../src/examples/cpp03/http/server/header.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/main.cpp" target="_top">../src/examples/cpp03/http/server/main.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/mime_types.cpp" target="_top">../src/examples/cpp03/http/server/mime_types.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/mime_types.hpp" target="_top">../src/examples/cpp03/http/server/mime_types.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/reply.cpp" target="_top">../src/examples/cpp03/http/server/reply.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/reply.hpp" target="_top">../src/examples/cpp03/http/server/reply.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/request.hpp" target="_top">../src/examples/cpp03/http/server/request.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/request_handler.cpp" target="_top">../src/examples/cpp03/http/server/request_handler.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/request_handler.hpp" target="_top">../src/examples/cpp03/http/server/request_handler.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/request_parser.cpp" target="_top">../src/examples/cpp03/http/server/request_parser.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/request_parser.hpp" target="_top">../src/examples/cpp03/http/server/request_parser.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/server.cpp" target="_top">../src/examples/cpp03/http/server/server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server/server.hpp" target="_top">../src/examples/cpp03/http/server/server.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h7"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.http_server_2"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server_2">HTTP
|
||||
Server 2</a>
|
||||
</h5>
|
||||
<p>
|
||||
An HTTP server using an io_service-per-CPU design.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/connection.cpp" target="_top">../src/examples/cpp03/http/server2/connection.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/connection.hpp" target="_top">../src/examples/cpp03/http/server2/connection.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/header.hpp" target="_top">../src/examples/cpp03/http/server2/header.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/io_service_pool.cpp" target="_top">../src/examples/cpp03/http/server2/io_service_pool.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/io_service_pool.hpp" target="_top">../src/examples/cpp03/http/server2/io_service_pool.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/main.cpp" target="_top">../src/examples/cpp03/http/server2/main.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/mime_types.cpp" target="_top">../src/examples/cpp03/http/server2/mime_types.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/mime_types.hpp" target="_top">../src/examples/cpp03/http/server2/mime_types.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/reply.cpp" target="_top">../src/examples/cpp03/http/server2/reply.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/reply.hpp" target="_top">../src/examples/cpp03/http/server2/reply.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/request.hpp" target="_top">../src/examples/cpp03/http/server2/request.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/request_handler.cpp" target="_top">../src/examples/cpp03/http/server2/request_handler.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/request_handler.hpp" target="_top">../src/examples/cpp03/http/server2/request_handler.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/request_parser.cpp" target="_top">../src/examples/cpp03/http/server2/request_parser.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/request_parser.hpp" target="_top">../src/examples/cpp03/http/server2/request_parser.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/server.cpp" target="_top">../src/examples/cpp03/http/server2/server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server2/server.hpp" target="_top">../src/examples/cpp03/http/server2/server.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h8"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.http_server_3"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server_3">HTTP
|
||||
Server 3</a>
|
||||
</h5>
|
||||
<p>
|
||||
An HTTP server using a single io_service and a thread pool calling <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/connection.cpp" target="_top">../src/examples/cpp03/http/server3/connection.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/connection.hpp" target="_top">../src/examples/cpp03/http/server3/connection.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/header.hpp" target="_top">../src/examples/cpp03/http/server3/header.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/main.cpp" target="_top">../src/examples/cpp03/http/server3/main.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/mime_types.cpp" target="_top">../src/examples/cpp03/http/server3/mime_types.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/mime_types.hpp" target="_top">../src/examples/cpp03/http/server3/mime_types.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/reply.cpp" target="_top">../src/examples/cpp03/http/server3/reply.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/reply.hpp" target="_top">../src/examples/cpp03/http/server3/reply.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/request.hpp" target="_top">../src/examples/cpp03/http/server3/request.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/request_handler.cpp" target="_top">../src/examples/cpp03/http/server3/request_handler.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/request_handler.hpp" target="_top">../src/examples/cpp03/http/server3/request_handler.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/request_parser.cpp" target="_top">../src/examples/cpp03/http/server3/request_parser.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/request_parser.hpp" target="_top">../src/examples/cpp03/http/server3/request_parser.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/server.cpp" target="_top">../src/examples/cpp03/http/server3/server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server3/server.hpp" target="_top">../src/examples/cpp03/http/server3/server.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h9"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.http_server_4"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server_4">HTTP
|
||||
Server 4</a>
|
||||
</h5>
|
||||
<p>
|
||||
A single-threaded HTTP server implemented using stackless coroutines.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/file_handler.cpp" target="_top">../src/examples/cpp03/http/server4/file_handler.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/file_handler.hpp" target="_top">../src/examples/cpp03/http/server4/file_handler.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/header.hpp" target="_top">../src/examples/cpp03/http/server4/header.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/main.cpp" target="_top">../src/examples/cpp03/http/server4/main.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/mime_types.cpp" target="_top">../src/examples/cpp03/http/server4/mime_types.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/mime_types.hpp" target="_top">../src/examples/cpp03/http/server4/mime_types.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/reply.cpp" target="_top">../src/examples/cpp03/http/server4/reply.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/reply.hpp" target="_top">../src/examples/cpp03/http/server4/reply.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/request.hpp" target="_top">../src/examples/cpp03/http/server4/request.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/request_parser.cpp" target="_top">../src/examples/cpp03/http/server4/request_parser.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/request_parser.hpp" target="_top">../src/examples/cpp03/http/server4/request_parser.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/server.cpp" target="_top">../src/examples/cpp03/http/server4/server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/http/server4/server.hpp" target="_top">../src/examples/cpp03/http/server4/server.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h10"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.icmp"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.icmp">ICMP</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example shows how to use raw sockets with ICMP to ping a remote host.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/icmp/ping.cpp" target="_top">../src/examples/cpp03/icmp/ping.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/icmp/ipv4_header.hpp" target="_top">../src/examples/cpp03/icmp/ipv4_header.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/icmp/icmp_header.hpp" target="_top">../src/examples/cpp03/icmp/icmp_header.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h11"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.invocation"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.invocation">Invocation</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example shows how to customise handler invocation. Completion handlers
|
||||
are added to a priority queue rather than executed immediately.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/invocation/prioritised_handlers.cpp" target="_top">../src/examples/cpp03/invocation/prioritised_handlers.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h12"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.iostreams"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.iostreams">Iostreams</a>
|
||||
</h5>
|
||||
<p>
|
||||
Two examples showing how to use <a class="link" href="../reference/ip__tcp/iostream.html" title="ip::tcp::iostream">ip::tcp::iostream</a>.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/iostreams/daytime_client.cpp" target="_top">../src/examples/cpp03/iostreams/daytime_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/iostreams/daytime_server.cpp" target="_top">../src/examples/cpp03/iostreams/daytime_server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/iostreams/http_client.cpp" target="_top">../src/examples/cpp03/iostreams/http_client.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h13"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.multicast"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.multicast">Multicast</a>
|
||||
</h5>
|
||||
<p>
|
||||
An example showing the use of multicast to transmit packets to a group of
|
||||
subscribers.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/multicast/receiver.cpp" target="_top">../src/examples/cpp03/multicast/receiver.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/multicast/sender.cpp" target="_top">../src/examples/cpp03/multicast/sender.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h14"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.serialization"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.serialization">Serialization</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example shows how Boost.Serialization can be used with asio to encode
|
||||
and decode structures for transmission over a socket.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/serialization/client.cpp" target="_top">../src/examples/cpp03/serialization/client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/serialization/connection.hpp" target="_top">../src/examples/cpp03/serialization/connection.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/serialization/server.cpp" target="_top">../src/examples/cpp03/serialization/server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/serialization/stock.hpp" target="_top">../src/examples/cpp03/serialization/stock.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h15"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.services"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.services">Services</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example demonstrates how to integrate custom functionality (in this
|
||||
case, for logging) into asio's <a class="link" href="../reference/io_service.html" title="io_service">io_service</a>,
|
||||
and how to use a custom service with <a class="link" href="../reference/basic_stream_socket.html" title="basic_stream_socket">basic_stream_socket<></a>.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/services/basic_logger.hpp" target="_top">../src/examples/cpp03/services/basic_logger.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/services/daytime_client.cpp" target="_top">../src/examples/cpp03/services/daytime_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/services/logger.hpp" target="_top">../src/examples/cpp03/services/logger.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/services/logger_service.cpp" target="_top">../src/examples/cpp03/services/logger_service.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/services/logger_service.hpp" target="_top">../src/examples/cpp03/services/logger_service.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/services/stream_socket_service.hpp" target="_top">../src/examples/cpp03/services/stream_socket_service.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h16"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.socks_4"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.socks_4">SOCKS
|
||||
4</a>
|
||||
</h5>
|
||||
<p>
|
||||
Example client program implementing the SOCKS 4 protocol for communication
|
||||
via a proxy.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/socks4/sync_client.cpp" target="_top">../src/examples/cpp03/socks4/sync_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/socks4/socks4.hpp" target="_top">../src/examples/cpp03/socks4/socks4.hpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h17"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.ssl"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.ssl">SSL</a>
|
||||
</h5>
|
||||
<p>
|
||||
Example client and server programs showing the use of the <a class="link" href="../reference/ssl__stream.html" title="ssl::stream">ssl::stream<></a>
|
||||
template with asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/ssl/client.cpp" target="_top">../src/examples/cpp03/ssl/client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/ssl/server.cpp" target="_top">../src/examples/cpp03/ssl/server.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h18"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.timeouts"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.timeouts">Timeouts</a>
|
||||
</h5>
|
||||
<p>
|
||||
A collection of examples showing how to cancel long running asynchronous
|
||||
operations after a period of time.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/timeouts/async_tcp_client.cpp" target="_top">../src/examples/cpp03/timeouts/async_tcp_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/timeouts/blocking_tcp_client.cpp" target="_top">../src/examples/cpp03/timeouts/blocking_tcp_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/timeouts/blocking_udp_client.cpp" target="_top">../src/examples/cpp03/timeouts/blocking_udp_client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/timeouts/server.cpp" target="_top">../src/examples/cpp03/timeouts/server.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h19"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.timers"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.timers">Timers</a>
|
||||
</h5>
|
||||
<p>
|
||||
Examples showing how to customise deadline_timer using different time types.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/timers/tick_count_timer.cpp" target="_top">../src/examples/cpp03/timers/tick_count_timer.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/timers/time_t_timer.cpp" target="_top">../src/examples/cpp03/timers/time_t_timer.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h20"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.porthopper"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.porthopper">Porthopper</a>
|
||||
</h5>
|
||||
<p>
|
||||
Example illustrating mixed synchronous and asynchronous operations, and how
|
||||
to use Boost.Lambda with Asio.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/porthopper/protocol.hpp" target="_top">../src/examples/cpp03/porthopper/protocol.hpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/porthopper/client.cpp" target="_top">../src/examples/cpp03/porthopper/client.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/porthopper/server.cpp" target="_top">../src/examples/cpp03/porthopper/server.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h21"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.nonblocking"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.nonblocking">Nonblocking</a>
|
||||
</h5>
|
||||
<p>
|
||||
Example demonstrating reactor-style operations for integrating a third-party
|
||||
library that wants to perform the I/O operations itself.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/nonblocking/third_party_lib.cpp" target="_top">../src/examples/cpp03/nonblocking/third_party_lib.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h22"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.spawn"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.spawn">Spawn</a>
|
||||
</h5>
|
||||
<p>
|
||||
Example of using the asio::spawn() function, a wrapper around the <a href="http://www.boost.org/doc/libs/release/libs/coroutine/index.html" target="_top">Boost.Coroutine</a>
|
||||
library, to implement a chain of asynchronous operations using stackful coroutines.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/spawn/echo_server.cpp" target="_top">../src/examples/cpp03/spawn/echo_server.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h23"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.unix_domain_sockets"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.unix_domain_sockets">UNIX
|
||||
Domain Sockets</a>
|
||||
</h5>
|
||||
<p>
|
||||
Examples showing how to use UNIX domain (local) sockets.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/local/connect_pair.cpp" target="_top">../src/examples/cpp03/local/connect_pair.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/local/stream_server.cpp" target="_top">../src/examples/cpp03/local/stream_server.cpp</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/local/stream_client.cpp" target="_top">../src/examples/cpp03/local/stream_client.cpp</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp03_examples.h24"></a>
|
||||
<span><a name="asio.examples.cpp03_examples.windows"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.windows">Windows</a>
|
||||
</h5>
|
||||
<p>
|
||||
An example showing how to use the Windows-specific function <code class="computeroutput"><span class="identifier">TransmitFile</span></code> with Asio.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp03/windows/transmit_file.cpp" target="_top">../src/examples/cpp03/windows/transmit_file.cpp</a>
|
||||
</li></ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp11_examples.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,237 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>C++11 Examples</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="cpp03_examples.html" title="C++03 Examples">
|
||||
<link rel="next" href="../reference.html" title="Reference">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="cpp03_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.examples.cpp11_examples"></a><a class="link" href="cpp11_examples.html" title="C++11 Examples">C++11 Examples</a>
|
||||
</h3></div></div></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp11_examples.h0"></a>
|
||||
<span><a name="asio.examples.cpp11_examples.allocation"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.allocation">Allocation</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example shows how to customise the allocation of memory associated with
|
||||
asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/allocation/server.cpp" target="_top">../src/examples/cpp11/allocation/server.cpp</a>
|
||||
(<a href="../../examples/diffs/allocation/server.cpp.html" target="_top">diff to C++03</a>)
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp11_examples.h1"></a>
|
||||
<span><a name="asio.examples.cpp11_examples.buffers"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.buffers">Buffers</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example demonstrates how to create reference counted buffers that can
|
||||
be used with socket read and write operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/buffers/reference_counted.cpp" target="_top">../src/examples/cpp11/buffers/reference_counted.cpp</a>
|
||||
(<a href="../../examples/diffs/buffers/reference_counted.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp11_examples.h2"></a>
|
||||
<span><a name="asio.examples.cpp11_examples.chat"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.chat">Chat</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example implements a chat server and client. The programs use a custom
|
||||
protocol with a fixed length message header and variable length message body.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/chat/chat_message.hpp" target="_top">../src/examples/cpp11/chat/chat_message.hpp</a>
|
||||
(<a href="../../examples/diffs/chat/chat_message.hpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/chat/chat_client.cpp" target="_top">../src/examples/cpp11/chat/chat_client.cpp</a>
|
||||
(<a href="../../examples/diffs/chat/chat_client.cpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/chat/chat_server.cpp" target="_top">../src/examples/cpp11/chat/chat_server.cpp</a>
|
||||
(<a href="../../examples/diffs/chat/chat_server.cpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp11_examples.h3"></a>
|
||||
<span><a name="asio.examples.cpp11_examples.echo"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.echo">Echo</a>
|
||||
</h5>
|
||||
<p>
|
||||
A collection of simple clients and servers, showing the use of both synchronous
|
||||
and asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/echo/async_tcp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/async_tcp_echo_server.cpp</a>
|
||||
(<a href="../../examples/diffs/echo/async_tcp_echo_server.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/echo/async_udp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/async_udp_echo_server.cpp</a>
|
||||
(<a href="../../examples/diffs/echo/async_udp_echo_server.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/echo/blocking_tcp_echo_client.cpp" target="_top">../src/examples/cpp11/echo/blocking_tcp_echo_client.cpp</a>
|
||||
(<a href="../../examples/diffs/echo/blocking_tcp_echo_client.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/echo/blocking_tcp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/blocking_tcp_echo_server.cpp</a>
|
||||
(<a href="../../examples/diffs/echo/blocking_tcp_echo_server.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/echo/blocking_udp_echo_client.cpp" target="_top">../src/examples/cpp11/echo/blocking_udp_echo_client.cpp</a>
|
||||
(<a href="../../examples/diffs/echo/blocking_udp_echo_client.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/echo/blocking_udp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/blocking_udp_echo_server.cpp</a>
|
||||
(<a href="../../examples/diffs/echo/blocking_udp_echo_server.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp11_examples.h4"></a>
|
||||
<span><a name="asio.examples.cpp11_examples.futures"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.futures">Futures</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example demonstrates how to use std::future in conjunction with Asio's
|
||||
asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/futures/daytime_client.cpp" target="_top">../src/examples/cpp11/futures/daytime_client.cpp</a>
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp11_examples.h5"></a>
|
||||
<span><a name="asio.examples.cpp11_examples.http_server"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.http_server">HTTP
|
||||
Server</a>
|
||||
</h5>
|
||||
<p>
|
||||
This example illustrates the use of asio in a simple single-threaded server
|
||||
implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown
|
||||
by cancelling all outstanding asynchronous operations.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/connection.cpp" target="_top">../src/examples/cpp11/http/server/connection.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/connection.cpp.html" target="_top">diff to
|
||||
C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/connection.hpp" target="_top">../src/examples/cpp11/http/server/connection.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/connection.hpp.html" target="_top">diff to
|
||||
C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/connection_manager.cpp" target="_top">../src/examples/cpp11/http/server/connection_manager.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/connection_manager.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/connection_manager.hpp" target="_top">../src/examples/cpp11/http/server/connection_manager.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/connection_manager.hpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/header.hpp" target="_top">../src/examples/cpp11/http/server/header.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/header.hpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/main.cpp" target="_top">../src/examples/cpp11/http/server/main.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/main.cpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/mime_types.cpp" target="_top">../src/examples/cpp11/http/server/mime_types.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/mime_types.cpp.html" target="_top">diff to
|
||||
C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/mime_types.hpp" target="_top">../src/examples/cpp11/http/server/mime_types.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/mime_types.hpp.html" target="_top">diff to
|
||||
C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/reply.cpp" target="_top">../src/examples/cpp11/http/server/reply.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/reply.cpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/reply.hpp" target="_top">../src/examples/cpp11/http/server/reply.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/reply.hpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/request.hpp" target="_top">../src/examples/cpp11/http/server/request.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/request.hpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/request_handler.cpp" target="_top">../src/examples/cpp11/http/server/request_handler.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/request_handler.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/request_handler.hpp" target="_top">../src/examples/cpp11/http/server/request_handler.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/request_handler.hpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/request_parser.cpp" target="_top">../src/examples/cpp11/http/server/request_parser.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/request_parser.cpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/request_parser.hpp" target="_top">../src/examples/cpp11/http/server/request_parser.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/request_parser.hpp.html" target="_top">diff
|
||||
to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/server.cpp" target="_top">../src/examples/cpp11/http/server/server.cpp</a>
|
||||
(<a href="../../examples/diffs/http/server/server.cpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/http/server/server.hpp" target="_top">../src/examples/cpp11/http/server/server.hpp</a>
|
||||
(<a href="../../examples/diffs/http/server/server.hpp.html" target="_top">diff to C++03</a>)
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.examples.cpp11_examples.h6"></a>
|
||||
<span><a name="asio.examples.cpp11_examples.spawn"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.spawn">Spawn</a>
|
||||
</h5>
|
||||
<p>
|
||||
Example of using the asio::spawn() function, a wrapper around the <a href="http://www.boost.org/doc/libs/release/libs/coroutine/index.html" target="_top">Boost.Coroutine</a>
|
||||
library, to implement a chain of asynchronous operations using stackful coroutines.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a href="../../../src/examples/cpp11/spawn/echo_server.cpp" target="_top">../src/examples/cpp11/spawn/echo_server.cpp</a>
|
||||
(<a href="../../examples/diffs/spawn/echo_server.cpp.html" target="_top">diff to C++03</a>)
|
||||
</li></ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="cpp03_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,149 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Overview</title>
|
||||
<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../index.html" title="Asio">
|
||||
<link rel="up" href="../index.html" title="Asio">
|
||||
<link rel="prev" href="../index.html" title="Asio">
|
||||
<link rel="next" href="overview/rationale.html" title="Rationale">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="overview/rationale.html"><img src="../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="asio.overview"></a><a class="link" href="overview.html" title="Overview">Overview</a>
|
||||
</h2></div></div></div>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/rationale.html" title="Rationale">Rationale</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core.html" title="Core Concepts and Functionality">Core Concepts and Functionality</a>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/basics.html" title="Basic Asio Anatomy">Basic Asio Anatomy</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/async.html" title="The Proactor Design Pattern: Concurrency Without Threads">The Proactor Design Pattern:
|
||||
Concurrency Without Threads</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/threads.html" title="Threads and Asio">Threads and Asio</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/strands.html" title="Strands: Use Threads Without Explicit Locking">Strands: Use Threads Without
|
||||
Explicit Locking</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/buffers.html" title="Buffers">Buffers</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/streams.html" title="Streams, Short Reads and Short Writes">Streams, Short Reads and
|
||||
Short Writes</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/reactor.html" title="Reactor-Style Operations">Reactor-Style Operations</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/line_based.html" title="Line-Based Operations">Line-Based Operations</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/allocation.html" title="Custom Memory Allocation">Custom Memory Allocation</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/handler_tracking.html" title="Handler Tracking">Handler Tracking</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/coroutine.html" title="Stackless Coroutines">Stackless Coroutines</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/core/spawn.html" title="Stackful Coroutines">Stackful Coroutines</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/networking.html" title="Networking">Networking</a>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/networking/protocols.html" title="TCP, UDP and ICMP">TCP, UDP and ICMP</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/networking/other_protocols.html" title="Support for Other Protocols">Support
|
||||
for Other Protocols</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/networking/iostreams.html" title="Socket Iostreams">Socket Iostreams</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/networking/bsd_sockets.html" title="The BSD Socket API and Asio">The BSD Socket
|
||||
API and Asio</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/timers.html" title="Timers">Timers</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/serial_ports.html" title="Serial Ports">Serial Ports</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/signals.html" title="Signal Handling">Signal Handling</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/posix.html" title="POSIX-Specific Functionality">POSIX-Specific Functionality</a>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/posix/local.html" title="UNIX Domain Sockets">UNIX Domain Sockets</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/posix/stream_descriptor.html" title="Stream-Oriented File Descriptors">Stream-Oriented
|
||||
File Descriptors</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/windows.html" title="Windows-Specific Functionality">Windows-Specific Functionality</a>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/windows/stream_handle.html" title="Stream-Oriented HANDLEs">Stream-Oriented
|
||||
HANDLEs</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/windows/random_access_handle.html" title="Random-Access HANDLEs">Random-Access
|
||||
HANDLEs</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/ssl.html" title="SSL">SSL</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/cpp2011.html" title="C++ 2011 Support">C++ 2011 Support</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="overview/implementation.html" title="Platform-Specific Implementation Notes">Platform-Specific Implementation
|
||||
Notes</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="overview/rationale.html"><img src="../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,78 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Core Concepts and Functionality</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="rationale.html" title="Rationale">
|
||||
<link rel="next" href="core/basics.html" title="Basic Asio Anatomy">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="rationale.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="core/basics.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.core"></a><a class="link" href="core.html" title="Core Concepts and Functionality">Core Concepts and Functionality</a>
|
||||
</h3></div></div></div>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/basics.html" title="Basic Asio Anatomy">Basic Asio Anatomy</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/async.html" title="The Proactor Design Pattern: Concurrency Without Threads">The Proactor Design Pattern:
|
||||
Concurrency Without Threads</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/threads.html" title="Threads and Asio">Threads and Asio</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/strands.html" title="Strands: Use Threads Without Explicit Locking">Strands: Use Threads Without
|
||||
Explicit Locking</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/buffers.html" title="Buffers">Buffers</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/streams.html" title="Streams, Short Reads and Short Writes">Streams, Short Reads and Short
|
||||
Writes</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/reactor.html" title="Reactor-Style Operations">Reactor-Style Operations</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/line_based.html" title="Line-Based Operations">Line-Based Operations</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/allocation.html" title="Custom Memory Allocation">Custom Memory Allocation</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/handler_tracking.html" title="Handler Tracking">Handler Tracking</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/coroutine.html" title="Stackless Coroutines">Stackless Coroutines</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="core/spawn.html" title="Stackful Coroutines">Stackful Coroutines</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="rationale.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="core/basics.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,100 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Custom Memory Allocation</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="line_based.html" title="Line-Based Operations">
|
||||
<link rel="next" href="handler_tracking.html" title="Handler Tracking">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="line_based.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="handler_tracking.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.allocation"></a><a class="link" href="allocation.html" title="Custom Memory Allocation">Custom Memory Allocation</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Many asynchronous operations need to allocate an object to store state
|
||||
associated with the operation. For example, a Win32 implementation needs
|
||||
<code class="computeroutput"><span class="identifier">OVERLAPPED</span></code>-derived objects
|
||||
to pass to Win32 API functions.
|
||||
</p>
|
||||
<p>
|
||||
Furthermore, programs typically contain easily identifiable chains of asynchronous
|
||||
operations. A half duplex protocol implementation (e.g. an HTTP server)
|
||||
would have a single chain of operations per client (receives followed by
|
||||
sends). A full duplex protocol implementation would have two chains executing
|
||||
in parallel. Programs should be able to leverage this knowledge to reuse
|
||||
memory for all asynchronous operations in a chain.
|
||||
</p>
|
||||
<p>
|
||||
Given a copy of a user-defined <code class="computeroutput"><span class="identifier">Handler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">h</span></code>, if the implementation
|
||||
needs to allocate memory associated with that handler it will execute the
|
||||
code:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span><span class="special">*</span> <span class="identifier">pointer</span> <span class="special">=</span> <span class="identifier">asio_handler_allocate</span><span class="special">(</span><span class="identifier">size</span><span class="special">,</span> <span class="special">&</span><span class="identifier">h</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Similarly, to deallocate the memory it will execute:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio_handler_deallocate</span><span class="special">(</span><span class="identifier">pointer</span><span class="special">,</span> <span class="identifier">size</span><span class="special">,</span> <span class="special">&</span><span class="identifier">h</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
These functions are located using argument-dependent lookup. The implementation
|
||||
provides default implementations of the above functions in the <code class="computeroutput"><span class="identifier">asio</span></code> namespace:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span><span class="special">*</span> <span class="identifier">asio_handler_allocate</span><span class="special">(</span><span class="identifier">size_t</span><span class="special">,</span> <span class="special">...);</span>
|
||||
<span class="keyword">void</span> <span class="identifier">asio_handler_deallocate</span><span class="special">(</span><span class="keyword">void</span><span class="special">*,</span> <span class="identifier">size_t</span><span class="special">,</span> <span class="special">...);</span>
|
||||
</pre>
|
||||
<p>
|
||||
which are implemented in terms of <code class="computeroutput"><span class="special">::</span><span class="keyword">operator</span> <span class="keyword">new</span><span class="special">()</span></code> and <code class="computeroutput"><span class="special">::</span><span class="keyword">operator</span> <span class="keyword">delete</span><span class="special">()</span></code> respectively.
|
||||
</p>
|
||||
<p>
|
||||
The implementation guarantees that the deallocation will occur before the
|
||||
associated handler is invoked, which means the memory is ready to be reused
|
||||
for any new asynchronous operations started by the handler.
|
||||
</p>
|
||||
<p>
|
||||
The custom memory allocation functions may be called from any user-created
|
||||
thread that is calling a library function. The implementation guarantees
|
||||
that, for the asynchronous operations included the library, the implementation
|
||||
will not make concurrent calls to the memory allocation functions for that
|
||||
handler. The implementation will insert appropriate memory barriers to
|
||||
ensure correct memory visibility should allocation functions need to be
|
||||
called from different threads.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.allocation.h0"></a>
|
||||
<span><a name="asio.overview.core.allocation.see_also"></a></span><a class="link" href="allocation.html#asio.overview.core.allocation.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/asio_handler_allocate.html" title="asio_handler_allocate">asio_handler_allocate</a>,
|
||||
<a class="link" href="../../reference/asio_handler_deallocate.html" title="asio_handler_deallocate">asio_handler_deallocate</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.allocation">custom memory allocation
|
||||
example (C++03)</a>, <a class="link" href="../../examples/cpp11_examples.html#asio.examples.cpp11_examples.allocation">custom
|
||||
memory allocation example (C++11)</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="line_based.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="handler_tracking.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,280 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>The Proactor Design Pattern: Concurrency Without Threads</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="basics.html" title="Basic Asio Anatomy">
|
||||
<link rel="next" href="threads.html" title="Threads and Asio">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basics.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="threads.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.async"></a><a class="link" href="async.html" title="The Proactor Design Pattern: Concurrency Without Threads">The Proactor Design Pattern:
|
||||
Concurrency Without Threads</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
The Asio library offers side-by-side support for synchronous and asynchronous
|
||||
operations. The asynchronous support is based on the Proactor design pattern
|
||||
<a class="link" href="async.html#asio.overview.core.async.references">[POSA2]</a>. The
|
||||
advantages and disadvantages of this approach, when compared to a synchronous-only
|
||||
or Reactor approach, are outlined below.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.async.h0"></a>
|
||||
<span><a name="asio.overview.core.async.proactor_and_asio"></a></span><a class="link" href="async.html#asio.overview.core.async.proactor_and_asio">Proactor
|
||||
and Asio</a>
|
||||
</h6>
|
||||
<p>
|
||||
Let us examine how the Proactor design pattern is implemented in Asio,
|
||||
without reference to platform-specific details.
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../proactor.png" alt="proactor"></span>
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Proactor design pattern (adapted from [POSA2])</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
— Asynchronous Operation
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Defines an operation that is executed asynchronously, such as an asynchronous
|
||||
read or write on a socket.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Asynchronous Operation Processor
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Executes asynchronous operations and queues events on a completion event
|
||||
queue when operations complete. From a high-level point of view, services
|
||||
like <code class="computeroutput"><span class="identifier">stream_socket_service</span></code>
|
||||
are asynchronous operation processors.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Completion Event Queue
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Buffers completion events until they are dequeued by an asynchronous
|
||||
event demultiplexer.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Completion Handler
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Processes the result of an asynchronous operation. These are function
|
||||
objects, often created using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code>.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Asynchronous Event Demultiplexer
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Blocks waiting for events to occur on the completion event queue, and
|
||||
returns a completed event to its caller.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Proactor
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Calls the asynchronous event demultiplexer to dequeue events, and dispatches
|
||||
the completion handler (i.e. invokes the function object) associated
|
||||
with the event. This abstraction is represented by the <code class="computeroutput"><span class="identifier">io_service</span></code> class.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Initiator
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Application-specific code that starts asynchronous operations. The initiator
|
||||
interacts with an asynchronous operation processor via a high-level interface
|
||||
such as <code class="computeroutput"><span class="identifier">basic_stream_socket</span></code>,
|
||||
which in turn delegates to a service like <code class="computeroutput"><span class="identifier">stream_socket_service</span></code>.
|
||||
</p></blockquote></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.async.h1"></a>
|
||||
<span><a name="asio.overview.core.async.implementation_using_reactor"></a></span><a class="link" href="async.html#asio.overview.core.async.implementation_using_reactor">Implementation
|
||||
Using Reactor</a>
|
||||
</h6>
|
||||
<p>
|
||||
On many platforms, Asio implements the Proactor design pattern in terms
|
||||
of a Reactor, such as <code class="computeroutput"><span class="identifier">select</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">epoll</span></code> or <code class="computeroutput"><span class="identifier">kqueue</span></code>. This implementation approach
|
||||
corresponds to the Proactor design pattern as follows:
|
||||
</p>
|
||||
<p>
|
||||
— Asynchronous Operation Processor
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
A reactor implemented using <code class="computeroutput"><span class="identifier">select</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">epoll</span></code> or <code class="computeroutput"><span class="identifier">kqueue</span></code>. When the reactor indicates
|
||||
that the resource is ready to perform the operation, the processor executes
|
||||
the asynchronous operation and enqueues the associated completion handler
|
||||
on the completion event queue.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Completion Event Queue
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
A linked list of completion handlers (i.e. function objects).
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Asynchronous Event Demultiplexer
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
This is implemented by waiting on an event or condition variable until
|
||||
a completion handler is available in the completion event queue.
|
||||
</p></blockquote></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.async.h2"></a>
|
||||
<span><a name="asio.overview.core.async.implementation_using_windows_overlapped_i_o"></a></span><a class="link" href="async.html#asio.overview.core.async.implementation_using_windows_overlapped_i_o">Implementation
|
||||
Using Windows Overlapped I/O</a>
|
||||
</h6>
|
||||
<p>
|
||||
On Windows NT, 2000 and XP, Asio takes advantage of overlapped I/O to provide
|
||||
an efficient implementation of the Proactor design pattern. This implementation
|
||||
approach corresponds to the Proactor design pattern as follows:
|
||||
</p>
|
||||
<p>
|
||||
— Asynchronous Operation Processor
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
This is implemented by the operating system. Operations are initiated
|
||||
by calling an overlapped function such as <code class="computeroutput"><span class="identifier">AcceptEx</span></code>.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Completion Event Queue
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
This is implemented by the operating system, and is associated with an
|
||||
I/O completion port. There is one I/O completion port for each <code class="computeroutput"><span class="identifier">io_service</span></code> instance.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Asynchronous Event Demultiplexer
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Called by Asio to dequeue events and their associated completion handlers.
|
||||
</p></blockquote></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.async.h3"></a>
|
||||
<span><a name="asio.overview.core.async.advantages"></a></span><a class="link" href="async.html#asio.overview.core.async.advantages">Advantages</a>
|
||||
</h6>
|
||||
<p>
|
||||
— Portability.
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Many operating systems offer a native asynchronous I/O API (such as overlapped
|
||||
I/O on <span class="emphasis"><em>Windows</em></span>) as the preferred option for developing
|
||||
high performance network applications. The library may be implemented
|
||||
in terms of native asynchronous I/O. However, if native support is not
|
||||
available, the library may also be implemented using synchronous event
|
||||
demultiplexors that typify the Reactor pattern, such as <span class="emphasis"><em>POSIX</em></span>
|
||||
<code class="computeroutput"><span class="identifier">select</span><span class="special">()</span></code>.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Decoupling threading from concurrency.
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Long-duration operations are performed asynchronously by the implementation
|
||||
on behalf of the application. Consequently applications do not need to
|
||||
spawn many threads in order to increase concurrency.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Performance and scalability.
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Implementation strategies such as thread-per-connection (which a synchronous-only
|
||||
approach would require) can degrade system performance, due to increased
|
||||
context switching, synchronisation and data movement among CPUs. With
|
||||
asynchronous operations it is possible to avoid the cost of context switching
|
||||
by minimising the number of operating system threads — typically a limited
|
||||
resource — and only activating the logical threads of control that have
|
||||
events to process.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Simplified application synchronisation.
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Asynchronous operation completion handlers can be written as though they
|
||||
exist in a single-threaded environment, and so application logic can
|
||||
be developed with little or no concern for synchronisation issues.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Function composition.
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Function composition refers to the implementation of functions to provide
|
||||
a higher-level operation, such as sending a message in a particular format.
|
||||
Each function is implemented in terms of multiple calls to lower-level
|
||||
read or write operations.
|
||||
</p></blockquote></div>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
For example, consider a protocol where each message consists of a fixed-length
|
||||
header followed by a variable length body, where the length of the body
|
||||
is specified in the header. A hypothetical read_message operation could
|
||||
be implemented using two lower-level reads, the first to receive the
|
||||
header and, once the length is known, the second to receive the body.
|
||||
</p></blockquote></div>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
To compose functions in an asynchronous model, asynchronous operations
|
||||
can be chained together. That is, a completion handler for one operation
|
||||
can initiate the next. Starting the first call in the chain can be encapsulated
|
||||
so that the caller need not be aware that the higher-level operation
|
||||
is implemented as a chain of asynchronous operations.
|
||||
</p></blockquote></div>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
The ability to compose new operations in this way simplifies the development
|
||||
of higher levels of abstraction above a networking library, such as functions
|
||||
to support a specific protocol.
|
||||
</p></blockquote></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.async.h4"></a>
|
||||
<span><a name="asio.overview.core.async.disadvantages"></a></span><a class="link" href="async.html#asio.overview.core.async.disadvantages">Disadvantages</a>
|
||||
</h6>
|
||||
<p>
|
||||
— Program complexity.
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
It is more difficult to develop applications using asynchronous mechanisms
|
||||
due to the separation in time and space between operation initiation
|
||||
and completion. Applications may also be harder to debug due to the inverted
|
||||
flow of control.
|
||||
</p></blockquote></div>
|
||||
<p>
|
||||
— Memory usage.
|
||||
</p>
|
||||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||||
Buffer space must be committed for the duration of a read or write operation,
|
||||
which may continue indefinitely, and a separate buffer is required for
|
||||
each concurrent operation. The Reactor pattern, on the other hand, does
|
||||
not require buffer space until a socket is ready for reading or writing.
|
||||
</p></blockquote></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.async.h5"></a>
|
||||
<span><a name="asio.overview.core.async.references"></a></span><a class="link" href="async.html#asio.overview.core.async.references">References</a>
|
||||
</h6>
|
||||
<p>
|
||||
[POSA2] D. Schmidt et al, <span class="emphasis"><em>Pattern Oriented Software Architecture,
|
||||
Volume 2</em></span>. Wiley, 2000.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basics.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="threads.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,167 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Basic Asio Anatomy</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="next" href="async.html" title="The Proactor Design Pattern: Concurrency Without Threads">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../core.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="async.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.basics"></a><a class="link" href="basics.html" title="Basic Asio Anatomy">Basic Asio Anatomy</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio may be used to perform both synchronous and asynchronous operations
|
||||
on I/O objects such as sockets. Before using Asio it may be useful to get
|
||||
a conceptual picture of the various parts of Asio, your program, and how
|
||||
they work together.
|
||||
</p>
|
||||
<p>
|
||||
As an introductory example, let's consider what happens when you perform
|
||||
a connect operation on a socket. We shall start by examining synchronous
|
||||
operations.
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../sync_op.png" alt="sync_op"></span>
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Your program</strong></span> will have at least one <span class="bold"><strong>io_service</strong></span> object. The <span class="bold"><strong>io_service</strong></span>
|
||||
represents <span class="bold"><strong>your program</strong></span>'s link to the
|
||||
<span class="bold"><strong>operating system</strong></span>'s I/O services.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span> <span class="identifier">io_service</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
To perform I/O operations <span class="bold"><strong>your program</strong></span>
|
||||
will need an <span class="bold"><strong>I/O object</strong></span> such as a TCP
|
||||
socket:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
When a synchronous connect operation is performed, the following sequence
|
||||
of events occurs:
|
||||
</p>
|
||||
<p>
|
||||
1. <span class="bold"><strong>Your program</strong></span> initiates the connect
|
||||
operation by calling the <span class="bold"><strong>I/O object</strong></span>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">socket</span><span class="special">.</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">server_endpoint</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
2. The <span class="bold"><strong>I/O object</strong></span> forwards the request
|
||||
to the <span class="bold"><strong>io_service</strong></span>.
|
||||
</p>
|
||||
<p>
|
||||
3. The <span class="bold"><strong>io_service</strong></span> calls on the <span class="bold"><strong>operating system</strong></span> to perform the connect operation.
|
||||
</p>
|
||||
<p>
|
||||
4. The <span class="bold"><strong>operating system</strong></span> returns the result
|
||||
of the operation to the <span class="bold"><strong>io_service</strong></span>.
|
||||
</p>
|
||||
<p>
|
||||
5. The <span class="bold"><strong>io_service</strong></span> translates any error
|
||||
resulting from the operation into an object of type <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span></code>.
|
||||
An <code class="computeroutput"><span class="identifier">error_code</span></code> may be compared
|
||||
with specific values, or tested as a boolean (where a <code class="computeroutput"><span class="keyword">false</span></code>
|
||||
result means that no error occurred). The result is then forwarded back
|
||||
up to the <span class="bold"><strong>I/O object</strong></span>.
|
||||
</p>
|
||||
<p>
|
||||
6. The <span class="bold"><strong>I/O object</strong></span> throws an exception
|
||||
of type <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">system_error</span></code> if the operation failed.
|
||||
If the code to initiate the operation had instead been written as:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">;</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">server_endpoint</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
then the <code class="computeroutput"><span class="identifier">error_code</span></code> variable
|
||||
<code class="computeroutput"><span class="identifier">ec</span></code> would be set to the
|
||||
result of the operation, and no exception would be thrown.
|
||||
</p>
|
||||
<p>
|
||||
When an asynchronous operation is used, a different sequence of events
|
||||
occurs.
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../async_op1.png" alt="async_op1"></span>
|
||||
</p>
|
||||
<p>
|
||||
1. <span class="bold"><strong>Your program</strong></span> initiates the connect
|
||||
operation by calling the <span class="bold"><strong>I/O object</strong></span>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_connect</span><span class="special">(</span><span class="identifier">server_endpoint</span><span class="special">,</span> <span class="identifier">your_completion_handler</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
where <code class="computeroutput"><span class="identifier">your_completion_handler</span></code>
|
||||
is a function or function object with the signature:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">your_completion_handler</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
The exact signature required depends on the asynchronous operation being
|
||||
performed. The reference documentation indicates the appropriate form for
|
||||
each operation.
|
||||
</p>
|
||||
<p>
|
||||
2. The <span class="bold"><strong>I/O object</strong></span> forwards the request
|
||||
to the <span class="bold"><strong>io_service</strong></span>.
|
||||
</p>
|
||||
<p>
|
||||
3. The <span class="bold"><strong>io_service</strong></span> signals to the <span class="bold"><strong>operating system</strong></span> that it should start an asynchronous
|
||||
connect.
|
||||
</p>
|
||||
<p>
|
||||
Time passes. (In the synchronous case this wait would have been contained
|
||||
entirely within the duration of the connect operation.)
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../async_op2.png" alt="async_op2"></span>
|
||||
</p>
|
||||
<p>
|
||||
4. The <span class="bold"><strong>operating system</strong></span> indicates that
|
||||
the connect operation has completed by placing the result on a queue, ready
|
||||
to be picked up by the <span class="bold"><strong>io_service</strong></span>.
|
||||
</p>
|
||||
<p>
|
||||
5. <span class="bold"><strong>Your program</strong></span> must make a call to <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>
|
||||
(or to one of the similar <span class="bold"><strong>io_service</strong></span> member
|
||||
functions) in order for the result to be retrieved. A call to <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>
|
||||
blocks while there are unfinished asynchronous operations, so you would
|
||||
typically call it as soon as you have started your first asynchronous operation.
|
||||
</p>
|
||||
<p>
|
||||
6. While inside the call to <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, the <span class="bold"><strong>io_service</strong></span>
|
||||
dequeues the result of the operation, translates it into an <code class="computeroutput"><span class="identifier">error_code</span></code>, and then passes it to <span class="bold"><strong>your completion handler</strong></span>.
|
||||
</p>
|
||||
<p>
|
||||
This is a simplified picture of how Asio operates. You will want to delve
|
||||
further into the documentation if your needs are more advanced, such as
|
||||
extending Asio to perform other types of asynchronous operations.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../core.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="async.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,235 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Buffers</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="strands.html" title="Strands: Use Threads Without Explicit Locking">
|
||||
<link rel="next" href="streams.html" title="Streams, Short Reads and Short Writes">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="strands.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="streams.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.buffers"></a><a class="link" href="buffers.html" title="Buffers">Buffers</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Fundamentally, I/O involves the transfer of data to and from contiguous
|
||||
regions of memory, called buffers. These buffers can be simply expressed
|
||||
as a tuple consisting of a pointer and a size in bytes. However, to allow
|
||||
the development of efficient network applications, Asio includes support
|
||||
for scatter-gather operations. These operations involve one or more buffers:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
A scatter-read receives data into multiple buffers.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
A gather-write transmits multiple buffers.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Therefore we require an abstraction to represent a collection of buffers.
|
||||
The approach used in Asio is to define a type (actually two types) to represent
|
||||
a single buffer. These can be stored in a container, which may be passed
|
||||
to the scatter-gather operations.
|
||||
</p>
|
||||
<p>
|
||||
In addition to specifying buffers as a pointer and size in bytes, Asio
|
||||
makes a distinction between modifiable memory (called mutable) and non-modifiable
|
||||
memory (where the latter is created from the storage for a const-qualified
|
||||
variable). These two types could therefore be defined as follows:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="keyword">void</span><span class="special">*,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">></span> <span class="identifier">mutable_buffer</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">></span> <span class="identifier">const_buffer</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
Here, a mutable_buffer would be convertible to a const_buffer, but conversion
|
||||
in the opposite direction is not valid.
|
||||
</p>
|
||||
<p>
|
||||
However, Asio does not use the above definitions as-is, but instead defines
|
||||
two classes: <code class="computeroutput"><span class="identifier">mutable_buffer</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">const_buffer</span></code>. The goal
|
||||
of these is to provide an opaque representation of contiguous memory, where:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Types behave as std::pair would in conversions. That is, a <code class="computeroutput"><span class="identifier">mutable_buffer</span></code> is convertible to
|
||||
a <code class="computeroutput"><span class="identifier">const_buffer</span></code>, but
|
||||
the opposite conversion is disallowed.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
There is protection against buffer overruns. Given a buffer instance,
|
||||
a user can only create another buffer representing the same range of
|
||||
memory or a sub-range of it. To provide further safety, the library
|
||||
also includes mechanisms for automatically determining the size of
|
||||
a buffer from an array, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code> of POD elements, or from a
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Type safety violations must be explicitly requested using the <code class="computeroutput"><span class="identifier">buffer_cast</span></code> function. In general
|
||||
an application should never need to do this, but it is required by
|
||||
the library implementation to pass the raw memory to the underlying
|
||||
operating system functions.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Finally, multiple buffers can be passed to scatter-gather operations (such
|
||||
as <a class="link" href="../../reference/read.html" title="read">read()</a> or <a class="link" href="../../reference/write.html" title="write">write()</a>)
|
||||
by putting the buffer objects into a container. The <code class="computeroutput"><span class="identifier">MutableBufferSequence</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">ConstBufferSequence</span></code>
|
||||
concepts have been defined so that containers such as <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span></code>, <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></code> can be used.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.buffers.h0"></a>
|
||||
<span><a name="asio.overview.core.buffers.streambuf_for_integration_with_iostreams"></a></span><a class="link" href="buffers.html#asio.overview.core.buffers.streambuf_for_integration_with_iostreams">Streambuf
|
||||
for Integration with Iostreams</a>
|
||||
</h6>
|
||||
<p>
|
||||
The class <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">basic_streambuf</span></code> is derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_streambuf</span></code> to associate the input
|
||||
sequence and output sequence with one or more objects of some character
|
||||
array type, whose elements store arbitrary values. These character array
|
||||
objects are internal to the streambuf object, but direct access to the
|
||||
array elements is provided to permit them to be used with I/O operations,
|
||||
such as the send or receive operations of a socket:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The input sequence of the streambuf is accessible via the <a class="link" href="../../reference/basic_streambuf/data.html" title="basic_streambuf::data">data()</a>
|
||||
member function. The return type of this function meets the <code class="computeroutput"><span class="identifier">ConstBufferSequence</span></code> requirements.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The output sequence of the streambuf is accessible via the <a class="link" href="../../reference/basic_streambuf/data.html" title="basic_streambuf::data">prepare()</a>
|
||||
member function. The return type of this function meets the <code class="computeroutput"><span class="identifier">MutableBufferSequence</span></code> requirements.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Data is transferred from the front of the output sequence to the back
|
||||
of the input sequence by calling the <a class="link" href="../../reference/basic_streambuf/commit.html" title="basic_streambuf::commit">commit()</a>
|
||||
member function.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Data is removed from the front of the input sequence by calling the
|
||||
<a class="link" href="../../reference/basic_streambuf/consume.html" title="basic_streambuf::consume">consume()</a>
|
||||
member function.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The streambuf constructor accepts a <code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
argument specifying the maximum of the sum of the sizes of the input sequence
|
||||
and output sequence. Any operation that would, if successful, grow the
|
||||
internal data beyond this limit will throw a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>
|
||||
exception.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.buffers.h1"></a>
|
||||
<span><a name="asio.overview.core.buffers.bytewise_traversal_of_buffer_sequences"></a></span><a class="link" href="buffers.html#asio.overview.core.buffers.bytewise_traversal_of_buffer_sequences">Bytewise
|
||||
Traversal of Buffer Sequences</a>
|
||||
</h6>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">buffers_iterator</span><span class="special"><></span></code>
|
||||
class template allows buffer sequences (i.e. types meeting <code class="computeroutput"><span class="identifier">MutableBufferSequence</span></code> or <code class="computeroutput"><span class="identifier">ConstBufferSequence</span></code> requirements) to
|
||||
be traversed as though they were a contiguous sequence of bytes. Helper
|
||||
functions called buffers_begin() and buffers_end() are also provided, where
|
||||
the buffers_iterator<> template parameter is automatically deduced.
|
||||
</p>
|
||||
<p>
|
||||
As an example, to read a single line from a socket and into a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>, you may write:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span> <span class="identifier">sb</span><span class="special">;</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">n</span> <span class="special">=</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">read_until</span><span class="special">(</span><span class="identifier">sock</span><span class="special">,</span> <span class="identifier">sb</span><span class="special">,</span> <span class="char">'\n'</span><span class="special">);</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span><span class="special">::</span><span class="identifier">const_buffers_type</span> <span class="identifier">bufs</span> <span class="special">=</span> <span class="identifier">sb</span><span class="special">.</span><span class="identifier">data</span><span class="special">();</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">line</span><span class="special">(</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffers_begin</span><span class="special">(</span><span class="identifier">bufs</span><span class="special">),</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffers_begin</span><span class="special">(</span><span class="identifier">bufs</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">n</span><span class="special">);</span>
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.overview.core.buffers.h2"></a>
|
||||
<span><a name="asio.overview.core.buffers.buffer_debugging"></a></span><a class="link" href="buffers.html#asio.overview.core.buffers.buffer_debugging">Buffer
|
||||
Debugging</a>
|
||||
</h6>
|
||||
<p>
|
||||
Some standard library implementations, such as the one that ships with
|
||||
Microsoft Visual C++ 8.0 and later, provide a feature called iterator debugging.
|
||||
What this means is that the validity of iterators is checked at runtime.
|
||||
If a program tries to use an iterator that has been invalidated, an assertion
|
||||
will be triggered. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">1</span><span class="special">)</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="identifier">v</span><span class="special">.</span><span class="identifier">clear</span><span class="special">();</span> <span class="comment">// invalidates iterators</span>
|
||||
<span class="special">*</span><span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="comment">// assertion!</span>
|
||||
</pre>
|
||||
<p>
|
||||
Asio takes advantage of this feature to add buffer debugging. Consider
|
||||
the following code:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">dont_do_this</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">msg</span> <span class="special">=</span> <span class="string">"Hello, world!"</span><span class="special">;</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_write</span><span class="special">(</span><span class="identifier">sock</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">msg</span><span class="special">),</span> <span class="identifier">my_handler</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
When you call an asynchronous read or write you need to ensure that the
|
||||
buffers for the operation are valid until the completion handler is called.
|
||||
In the above example, the buffer is the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>
|
||||
variable <code class="computeroutput"><span class="identifier">msg</span></code>. This variable
|
||||
is on the stack, and so it goes out of scope before the asynchronous operation
|
||||
completes. If you're lucky then the application will crash, but random
|
||||
failures are more likely.
|
||||
</p>
|
||||
<p>
|
||||
When buffer debugging is enabled, Asio stores an iterator into the string
|
||||
until the asynchronous operation completes, and then dereferences it to
|
||||
check its validity. In the above example you would observe an assertion
|
||||
failure just before Asio tries to call the completion handler.
|
||||
</p>
|
||||
<p>
|
||||
This feature is automatically made available for Microsoft Visual Studio
|
||||
8.0 or later and for GCC when <code class="computeroutput"><span class="identifier">_GLIBCXX_DEBUG</span></code>
|
||||
is defined. There is a performance cost to this checking, so buffer debugging
|
||||
is only enabled in debug builds. For other compilers it may be enabled
|
||||
by defining <code class="computeroutput"><span class="identifier">ASIO_ENABLE_BUFFER_DEBUGGING</span></code>.
|
||||
It can also be explicitly disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_BUFFER_DEBUGGING</span></code>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.buffers.h3"></a>
|
||||
<span><a name="asio.overview.core.buffers.see_also"></a></span><a class="link" href="buffers.html#asio.overview.core.buffers.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/buffer.html" title="buffer">buffer</a>, <a class="link" href="../../reference/buffers_begin.html" title="buffers_begin">buffers_begin</a>,
|
||||
<a class="link" href="../../reference/buffers_end.html" title="buffers_end">buffers_end</a>, <a class="link" href="../../reference/buffers_iterator.html" title="buffers_iterator">buffers_iterator</a>,
|
||||
<a class="link" href="../../reference/const_buffer.html" title="const_buffer">const_buffer</a>, <a class="link" href="../../reference/const_buffers_1.html" title="const_buffers_1">const_buffers_1</a>, <a class="link" href="../../reference/mutable_buffer.html" title="mutable_buffer">mutable_buffer</a>, <a class="link" href="../../reference/mutable_buffers_1.html" title="mutable_buffers_1">mutable_buffers_1</a>,
|
||||
<a class="link" href="../../reference/streambuf.html" title="streambuf">streambuf</a>, <a class="link" href="../../reference/ConstBufferSequence.html" title="Constant buffer sequence requirements">ConstBufferSequence</a>,
|
||||
<a class="link" href="../../reference/MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.buffers">buffers example (C++03)</a>,
|
||||
<a class="link" href="../../examples/cpp11_examples.html#asio.examples.cpp11_examples.buffers">buffers example (c++11)</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="strands.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="streams.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,85 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Stackless Coroutines</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="handler_tracking.html" title="Handler Tracking">
|
||||
<link rel="next" href="spawn.html" title="Stackful Coroutines">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="handler_tracking.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="spawn.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.coroutine"></a><a class="link" href="coroutine.html" title="Stackless Coroutines">Stackless Coroutines</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
The <a class="link" href="../../reference/coroutine.html" title="coroutine"><code class="computeroutput"><span class="identifier">coroutine</span></code></a>
|
||||
class provides support for stackless coroutines. Stackless coroutines enable
|
||||
programs to implement asynchronous logic in a synchronous manner, with
|
||||
minimal overhead, as shown in the following example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">session</span> <span class="special">:</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">coroutine</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special"><</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">></span> <span class="identifier">socket_</span><span class="special">;</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span> <span class="special">></span> <span class="identifier">buffer_</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">session</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special"><</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">></span> <span class="identifier">socket</span><span class="special">)</span>
|
||||
<span class="special">:</span> <span class="identifier">socket_</span><span class="special">(</span><span class="identifier">socket</span><span class="special">),</span>
|
||||
<span class="identifier">buffer_</span><span class="special">(</span><span class="keyword">new</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">>(</span><span class="number">1024</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">(),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">n</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(!</span><span class="identifier">ec</span><span class="special">)</span> <span class="identifier">reenter</span> <span class="special">(</span><span class="keyword">this</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">for</span> <span class="special">(;;)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">yield</span> <span class="identifier">socket_</span><span class="special">-></span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(*</span><span class="identifier">buffer_</span><span class="special">),</span> <span class="special">*</span><span class="keyword">this</span><span class="special">);</span>
|
||||
<span class="identifier">yield</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_write</span><span class="special">(*</span><span class="identifier">socket_</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(*</span><span class="identifier">buffer_</span><span class="special">,</span> <span class="identifier">n</span><span class="special">),</span> <span class="special">*</span><span class="keyword">this</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">coroutine</span></code> class is
|
||||
used in conjunction with the pseudo-keywords <code class="computeroutput"><span class="identifier">reenter</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">yield</span></code> and <code class="computeroutput"><span class="identifier">fork</span></code>. These are preprocessor macros,
|
||||
and are implemented in terms of a <code class="computeroutput"><span class="keyword">switch</span></code>
|
||||
statement using a technique similar to Duff's Device. The <a class="link" href="../../reference/coroutine.html" title="coroutine"><code class="computeroutput"><span class="identifier">coroutine</span></code></a> class's documentation
|
||||
provides a complete description of these pseudo-keywords.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.coroutine.h0"></a>
|
||||
<span><a name="asio.overview.core.coroutine.see_also"></a></span><a class="link" href="coroutine.html#asio.overview.core.coroutine.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/coroutine.html" title="coroutine">coroutine</a>, <a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.http_server_4">HTTP
|
||||
Server 4 example</a>, <a class="link" href="spawn.html" title="Stackful Coroutines">Stackful
|
||||
Coroutines</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="handler_tracking.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="spawn.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,144 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Handler Tracking</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="allocation.html" title="Custom Memory Allocation">
|
||||
<link rel="next" href="coroutine.html" title="Stackless Coroutines">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="allocation.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="coroutine.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.handler_tracking"></a><a class="link" href="handler_tracking.html" title="Handler Tracking">Handler Tracking</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
To aid in debugging asynchronous programs, Asio provides support for handler
|
||||
tracking. When enabled by defining <code class="computeroutput"><span class="identifier">ASIO_ENABLE_HANDLER_TRACKING</span></code>,
|
||||
Asio writes debugging output to the standard error stream. The output records
|
||||
asynchronous operations and the relationships between their handlers.
|
||||
</p>
|
||||
<p>
|
||||
This feature is useful when debugging and you need to know how your asynchronous
|
||||
operations are chained together, or what the pending asynchronous operations
|
||||
are. As an illustration, here is the output when you run the HTTP Server
|
||||
example, handle a single request, then shut down via Ctrl+C:
|
||||
</p>
|
||||
<pre class="programlisting">@asio|1298160085.070638|0*1|signal_set@0x7fff50528f40.async_wait
|
||||
@asio|1298160085.070888|0*2|socket@0x7fff50528f60.async_accept
|
||||
@asio|1298160085.070913|0|resolver@0x7fff50528e28.cancel
|
||||
@asio|1298160118.075438|>2|ec=asio.system:0
|
||||
@asio|1298160118.075472|2*3|socket@0xb39048.async_receive
|
||||
@asio|1298160118.075507|2*4|socket@0x7fff50528f60.async_accept
|
||||
@asio|1298160118.075527|<2|
|
||||
@asio|1298160118.075540|>3|ec=asio.system:0,bytes_transferred=122
|
||||
@asio|1298160118.075731|3*5|socket@0xb39048.async_send
|
||||
@asio|1298160118.075778|<3|
|
||||
@asio|1298160118.075793|>5|ec=asio.system:0,bytes_transferred=156
|
||||
@asio|1298160118.075831|5|socket@0xb39048.close
|
||||
@asio|1298160118.075855|<5|
|
||||
@asio|1298160122.827317|>1|ec=asio.system:0,signal_number=2
|
||||
@asio|1298160122.827333|1|socket@0x7fff50528f60.close
|
||||
@asio|1298160122.827359|<1|
|
||||
@asio|1298160122.827370|>4|ec=asio.system:125
|
||||
@asio|1298160122.827378|<4|
|
||||
@asio|1298160122.827394|0|signal_set@0x7fff50528f40.cancel
|
||||
</pre>
|
||||
<p>
|
||||
Each line is of the form:
|
||||
</p>
|
||||
<pre class="programlisting"><tag>|<timestamp>|<action>|<description>
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput"><tag></code> is always <code class="computeroutput">@asio</code>, and is used
|
||||
to identify and extract the handler tracking messages from the program
|
||||
output.
|
||||
</p>
|
||||
<p>
|
||||
The <code class="computeroutput"><timestamp></code> is seconds and microseconds from 1 Jan
|
||||
1970 UTC.
|
||||
</p>
|
||||
<p>
|
||||
The <code class="computeroutput"><action></code> takes one of the following forms:
|
||||
</p>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">>n</span></dt>
|
||||
<dd><p>
|
||||
The program entered the handler number <code class="computeroutput">n</code>. The <code class="computeroutput"><description></code>
|
||||
shows the arguments to the handler.
|
||||
</p></dd>
|
||||
<dt><span class="term"><n</span></dt>
|
||||
<dd><p>
|
||||
The program left handler number <code class="computeroutput">n</code>.
|
||||
</p></dd>
|
||||
<dt><span class="term">!n</span></dt>
|
||||
<dd><p>
|
||||
The program left handler number n due to an exception.
|
||||
</p></dd>
|
||||
<dt><span class="term">~n</span></dt>
|
||||
<dd><p>
|
||||
The handler number <code class="computeroutput">n</code> was destroyed without having been
|
||||
invoked. This is usually the case for any unfinished asynchronous
|
||||
operations when the <code class="computeroutput">io_service</code> is destroyed.
|
||||
</p></dd>
|
||||
<dt><span class="term">n*m</span></dt>
|
||||
<dd><p>
|
||||
The handler number <code class="computeroutput">n</code> created a new asynchronous operation
|
||||
with completion handler number <code class="computeroutput">m</code>. The <code class="computeroutput"><description></code>
|
||||
shows what asynchronous operation was started.
|
||||
</p></dd>
|
||||
<dt><span class="term">n</span></dt>
|
||||
<dd><p>
|
||||
The handler number n performed some other operation. The <code class="computeroutput"><description></code>
|
||||
shows what function was called. Currently only <code class="computeroutput">close()</code>
|
||||
and <code class="computeroutput">cancel()</code> operations are logged, as these may affect
|
||||
the state of pending asynchronous operations.
|
||||
</p></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
Where the <code class="computeroutput"><description></code> shows a synchronous or asynchronous
|
||||
operation, the format is <code class="computeroutput"><object-type>@<pointer>.<operation></code>.
|
||||
For handler entry, it shows a comma-separated list of arguments and their
|
||||
values.
|
||||
</p>
|
||||
<p>
|
||||
As shown above, Each handler is assigned a numeric identifier. Where the
|
||||
handler tracking output shows a handler number of 0, it means that the
|
||||
action was performed outside of any handler.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.handler_tracking.h0"></a>
|
||||
<span><a name="asio.overview.core.handler_tracking.visual_representations"></a></span><a class="link" href="handler_tracking.html#asio.overview.core.handler_tracking.visual_representations">Visual
|
||||
Representations</a>
|
||||
</h6>
|
||||
<p>
|
||||
The handler tracking output may be post-processed using the included <code class="literal">handlerviz.pl</code>
|
||||
tool to create a visual representation of the handlers (requires the GraphViz
|
||||
tool <code class="literal">dot</code>).
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="allocation.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="coroutine.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,158 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Line-Based Operations</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="reactor.html" title="Reactor-Style Operations">
|
||||
<link rel="next" href="allocation.html" title="Custom Memory Allocation">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="reactor.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="allocation.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.line_based"></a><a class="link" href="line_based.html" title="Line-Based Operations">Line-Based Operations</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Many commonly-used internet protocols are line-based, which means that
|
||||
they have protocol elements that are delimited by the character sequence
|
||||
<code class="computeroutput"><span class="string">"\r\n"</span></code>. Examples
|
||||
include HTTP, SMTP and FTP. To more easily permit the implementation of
|
||||
line-based protocols, as well as other protocols that use delimiters, Asio
|
||||
includes the functions <code class="computeroutput"><span class="identifier">read_until</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The following example illustrates the use of <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code> in an HTTP server, to receive the first
|
||||
line of an HTTP request from a client:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">http_connection</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">start</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_read_until</span><span class="special">(</span><span class="identifier">socket_</span><span class="special">,</span> <span class="identifier">data_</span><span class="special">,</span> <span class="string">"\r\n"</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">http_connection</span><span class="special">::</span><span class="identifier">handle_request_line</span><span class="special">,</span> <span class="keyword">this</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">));</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">handle_request_line</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(!</span><span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">method</span><span class="special">,</span> <span class="identifier">uri</span><span class="special">,</span> <span class="identifier">version</span><span class="special">;</span>
|
||||
<span class="keyword">char</span> <span class="identifier">sp1</span><span class="special">,</span> <span class="identifier">sp2</span><span class="special">,</span> <span class="identifier">cr</span><span class="special">,</span> <span class="identifier">lf</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span> <span class="identifier">is</span><span class="special">(&</span><span class="identifier">data_</span><span class="special">);</span>
|
||||
<span class="identifier">is</span><span class="special">.</span><span class="identifier">unsetf</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">skipws</span><span class="special">);</span>
|
||||
<span class="identifier">is</span> <span class="special">>></span> <span class="identifier">method</span> <span class="special">>></span> <span class="identifier">sp1</span> <span class="special">>></span> <span class="identifier">uri</span> <span class="special">>></span> <span class="identifier">sp2</span> <span class="special">>></span> <span class="identifier">version</span> <span class="special">>></span> <span class="identifier">cr</span> <span class="special">>></span> <span class="identifier">lf</span><span class="special">;</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="special">...</span>
|
||||
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket_</span><span class="special">;</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span> <span class="identifier">data_</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">streambuf</span></code> data member
|
||||
serves as a place to store the data that has been read from the socket
|
||||
before it is searched for the delimiter. It is important to remember that
|
||||
there may be additional data <span class="emphasis"><em>after</em></span> the delimiter.
|
||||
This surplus data should be left in the <code class="computeroutput"><span class="identifier">streambuf</span></code>
|
||||
so that it may be inspected by a subsequent call to <code class="computeroutput"><span class="identifier">read_until</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The delimiters may be specified as a single <code class="computeroutput"><span class="keyword">char</span></code>,
|
||||
a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code> or a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span></code>.
|
||||
The <code class="computeroutput"><span class="identifier">read_until</span><span class="special">()</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code>
|
||||
functions also include overloads that accept a user-defined function object
|
||||
called a match condition. For example, to read data into a streambuf until
|
||||
whitespace is encountered:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffers_iterator</span><span class="special"><</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span><span class="special">::</span><span class="identifier">const_buffers_type</span><span class="special">></span> <span class="identifier">iterator</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">></span>
|
||||
<span class="identifier">match_whitespace</span><span class="special">(</span><span class="identifier">iterator</span> <span class="identifier">begin</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="identifier">end</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">begin</span><span class="special">;</span>
|
||||
<span class="keyword">while</span> <span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">)</span>
|
||||
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">isspace</span><span class="special">(*</span><span class="identifier">i</span><span class="special">++))</span>
|
||||
<span class="keyword">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">i</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">i</span><span class="special">,</span> <span class="keyword">false</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">read_until</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">match_whitespace</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
To read data into a streambuf until a matching character is found:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">match_char</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">explicit</span> <span class="identifier">match_char</span><span class="special">(</span><span class="keyword">char</span> <span class="identifier">c</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">c_</span><span class="special">(</span><span class="identifier">c</span><span class="special">)</span> <span class="special">{}</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">></span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="identifier">Iterator</span> <span class="identifier">begin</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">Iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">begin</span><span class="special">;</span>
|
||||
<span class="keyword">while</span> <span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">)</span>
|
||||
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">c_</span> <span class="special">==</span> <span class="special">*</span><span class="identifier">i</span><span class="special">++)</span>
|
||||
<span class="keyword">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">i</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">i</span><span class="special">,</span> <span class="keyword">false</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">private</span><span class="special">:</span>
|
||||
<span class="keyword">char</span> <span class="identifier">c_</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">namespace</span> <span class="identifier">asio</span> <span class="special">{</span>
|
||||
<span class="keyword">template</span> <span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">is_match_condition</span><span class="special"><</span><span class="identifier">match_char</span><span class="special">></span>
|
||||
<span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">true_type</span> <span class="special">{};</span>
|
||||
<span class="special">}</span> <span class="comment">// namespace asio</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">read_until</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">match_char</span><span class="special">(</span><span class="char">'a'</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">is_match_condition</span><span class="special"><></span></code> type trait automatically evaluates
|
||||
to true for functions, and for function objects with a nested <code class="computeroutput"><span class="identifier">result_type</span></code> typedef. For other types
|
||||
the trait must be explicitly specialised, as shown above.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.line_based.h0"></a>
|
||||
<span><a name="asio.overview.core.line_based.see_also"></a></span><a class="link" href="line_based.html#asio.overview.core.line_based.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/async_read_until.html" title="async_read_until">async_read_until()</a>,
|
||||
<a class="link" href="../../reference/is_match_condition.html" title="is_match_condition">is_match_condition</a>,
|
||||
<a class="link" href="../../reference/read_until.html" title="read_until">read_until()</a>, <a class="link" href="../../reference/streambuf.html" title="streambuf">streambuf</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.http_client">HTTP client example</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="reactor.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="allocation.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,78 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Reactor-Style Operations</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="streams.html" title="Streams, Short Reads and Short Writes">
|
||||
<link rel="next" href="line_based.html" title="Line-Based Operations">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="streams.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="line_based.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.reactor"></a><a class="link" href="reactor.html" title="Reactor-Style Operations">Reactor-Style Operations</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Sometimes a program must be integrated with a third-party library that
|
||||
wants to perform the I/O operations itself. To facilitate this, Asio includes
|
||||
a <code class="computeroutput"><span class="identifier">null_buffers</span></code> type that
|
||||
can be used with both read and write operations. A <code class="computeroutput"><span class="identifier">null_buffers</span></code>
|
||||
operation doesn't return until the I/O object is "ready" to perform
|
||||
the operation.
|
||||
</p>
|
||||
<p>
|
||||
As an example, to perform a non-blocking read something like the following
|
||||
may be used:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">non_blocking</span><span class="special">(</span><span class="keyword">true</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">null_buffers</span><span class="special">(),</span> <span class="identifier">read_handler</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="identifier">read_handler</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(!</span><span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span> <span class="identifier">buf</span><span class="special">(</span><span class="identifier">socket</span><span class="special">.</span><span class="identifier">available</span><span class="special">());</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">read_some</span><span class="special">(</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">buf</span><span class="special">));</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
These operations are supported for sockets on all platforms, and for the
|
||||
POSIX stream-oriented descriptor classes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.reactor.h0"></a>
|
||||
<span><a name="asio.overview.core.reactor.see_also"></a></span><a class="link" href="reactor.html#asio.overview.core.reactor.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/null_buffers.html" title="null_buffers">null_buffers</a>, <a class="link" href="../../reference/basic_socket/non_blocking.html" title="basic_socket::non_blocking">basic_socket::non_blocking()</a>,
|
||||
<a class="link" href="../../reference/basic_socket/native_non_blocking.html" title="basic_socket::native_non_blocking">basic_socket::native_non_blocking()</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.nonblocking">nonblocking example</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="streams.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="line_based.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,147 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Stackful Coroutines</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="coroutine.html" title="Stackless Coroutines">
|
||||
<link rel="next" href="../networking.html" title="Networking">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="coroutine.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../networking.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.spawn"></a><a class="link" href="spawn.html" title="Stackful Coroutines">Stackful Coroutines</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
The <a class="link" href="../../reference/spawn.html" title="spawn"><code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code></a> function is a high-level wrapper
|
||||
for running stackful coroutines. It is based on the Boost.Coroutine library.
|
||||
The <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
|
||||
function enables programs to implement asynchronous logic in a synchronous
|
||||
manner, as shown in the following example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">spawn</span><span class="special">(</span><span class="identifier">my_strand</span><span class="special">,</span> <span class="identifier">do_echo</span><span class="special">);</span>
|
||||
|
||||
<span class="comment">// ...</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">do_echo</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">yield_context</span> <span class="identifier">yield</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">try</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">char</span> <span class="identifier">data</span><span class="special">[</span><span class="number">128</span><span class="special">];</span>
|
||||
<span class="keyword">for</span> <span class="special">(;;)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">length</span> <span class="special">=</span>
|
||||
<span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">yield</span><span class="special">);</span>
|
||||
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_write</span><span class="special">(</span><span class="identifier">my_socket</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">,</span> <span class="identifier">length</span><span class="special">),</span> <span class="identifier">yield</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">catch</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span><span class="special">&</span> <span class="identifier">e</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// ...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
The first argument to <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code> may be a <a class="link" href="../../reference/io_service__strand.html" title="io_service::strand"><code class="computeroutput"><span class="identifier">strand</span></code></a>, <a class="link" href="../../reference/io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>, or <a class="link" href="../../reference/CompletionHandler.html" title="Completion handler requirements">completion
|
||||
handler</a>. This argument determines the context in which the coroutine
|
||||
is permitted to execute. For example, a server's per-client object may
|
||||
consist of multiple coroutines; they should all run on the same <code class="computeroutput"><span class="identifier">strand</span></code> so that no explicit synchronisation
|
||||
is required.
|
||||
</p>
|
||||
<p>
|
||||
The second argument is a function object with signature:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">coroutine</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">yield_context</span> <span class="identifier">yield</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
that specifies the code to be run as part of the coroutine. The parameter
|
||||
<code class="computeroutput"><span class="identifier">yield</span></code> may be passed to
|
||||
an asynchronous operation in place of the completion handler, as in:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">length</span> <span class="special">=</span>
|
||||
<span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">yield</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
This starts the asynchronous operation and suspends the coroutine. The
|
||||
coroutine will be resumed automatically when the asynchronous operation
|
||||
completes.
|
||||
</p>
|
||||
<p>
|
||||
Where an asynchronous operation's handler signature has the form:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="identifier">result_type</span> <span class="identifier">result</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
the initiating function returns the result_type. In the <code class="computeroutput"><span class="identifier">async_read_some</span></code>
|
||||
example above, this is <code class="computeroutput"><span class="identifier">size_t</span></code>.
|
||||
If the asynchronous operation fails, the <code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
is converted into a <code class="computeroutput"><span class="identifier">system_error</span></code>
|
||||
exception and thrown.
|
||||
</p>
|
||||
<p>
|
||||
Where a handler signature has the form:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
the initiating function returns <code class="computeroutput"><span class="keyword">void</span></code>.
|
||||
As above, an error is passed back to the coroutine as a <code class="computeroutput"><span class="identifier">system_error</span></code>
|
||||
exception.
|
||||
</p>
|
||||
<p>
|
||||
To collect the <code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
from an operation, rather than have it throw an exception, associate the
|
||||
output variable with the <code class="computeroutput"><span class="identifier">yield_context</span></code>
|
||||
as follows:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">length</span> <span class="special">=</span>
|
||||
<span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">yield</span><span class="special">[</span><span class="identifier">ec</span><span class="special">]);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Note:</strong></span> if <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code> is used with a custom completion handler
|
||||
of type <code class="computeroutput"><span class="identifier">Handler</span></code>, the function
|
||||
object signature is actually:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">coroutine</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">basic_yield_context</span><span class="special"><</span><span class="identifier">Handler</span><span class="special">></span> <span class="identifier">yield</span><span class="special">);</span>
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.overview.core.spawn.h0"></a>
|
||||
<span><a name="asio.overview.core.spawn.see_also"></a></span><a class="link" href="spawn.html#asio.overview.core.spawn.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/spawn.html" title="spawn">spawn</a>, <a class="link" href="../../reference/yield_context.html" title="yield_context">yield_context</a>,
|
||||
<a class="link" href="../../reference/basic_yield_context.html" title="basic_yield_context">basic_yield_context</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.spawn">Spawn example (C++03)</a>,
|
||||
<a class="link" href="../../examples/cpp11_examples.html#asio.examples.cpp11_examples.spawn">Spawn example (C++11)</a>,
|
||||
<a class="link" href="coroutine.html" title="Stackless Coroutines">Stackless Coroutines</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="coroutine.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../networking.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,104 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Strands: Use Threads Without Explicit Locking</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="threads.html" title="Threads and Asio">
|
||||
<link rel="next" href="buffers.html" title="Buffers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="threads.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="buffers.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.strands"></a><a class="link" href="strands.html" title="Strands: Use Threads Without Explicit Locking">Strands: Use Threads Without
|
||||
Explicit Locking</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
A strand is defined as a strictly sequential invocation of event handlers
|
||||
(i.e. no concurrent invocation). Use of strands allows execution of code
|
||||
in a multithreaded program without the need for explicit locking (e.g.
|
||||
using mutexes).
|
||||
</p>
|
||||
<p>
|
||||
Strands may be either implicit or explicit, as illustrated by the following
|
||||
alternative approaches:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Calling io_service::run() from only one thread means all event handlers
|
||||
execute in an implicit strand, due to the io_service's guarantee that
|
||||
handlers are only invoked from inside run().
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Where there is a single chain of asynchronous operations associated
|
||||
with a connection (e.g. in a half duplex protocol implementation like
|
||||
HTTP) there is no possibility of concurrent execution of the handlers.
|
||||
This is an implicit strand.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An explicit strand is an instance of <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">strand</span></code>.
|
||||
All event handler function objects need to be wrapped using <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">strand</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">()</span></code>
|
||||
or otherwise posted/dispatched through the <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">strand</span></code>
|
||||
object.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
In the case of composed asynchronous operations, such as <code class="computeroutput"><span class="identifier">async_read</span><span class="special">()</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code>,
|
||||
if a completion handler goes through a strand, then all intermediate handlers
|
||||
should also go through the same strand. This is needed to ensure thread
|
||||
safe access for any objects that are shared between the caller and the
|
||||
composed operation (in the case of <code class="computeroutput"><span class="identifier">async_read</span><span class="special">()</span></code> it's the socket, which the caller can
|
||||
close() to cancel the operation). This is done by having hook functions
|
||||
for all intermediate handlers which forward the calls to the customisable
|
||||
hook associated with the final handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">my_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()()</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span>
|
||||
<span class="keyword">void</span> <span class="identifier">asio_handler_invoke</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">my_handler</span><span class="special">*)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// Do custom invocation here.</span>
|
||||
<span class="comment">// Default implementation calls f();</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">strand</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">()</span></code>
|
||||
function creates a new completion handler that defines <code class="computeroutput"><span class="identifier">asio_handler_invoke</span></code>
|
||||
so that the function object is executed through the strand.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.strands.h0"></a>
|
||||
<span><a name="asio.overview.core.strands.see_also"></a></span><a class="link" href="strands.html#asio.overview.core.strands.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/io_service__strand.html" title="io_service::strand">io_service::strand</a>,
|
||||
<a class="link" href="../../tutorial/tuttimer5.html" title="Timer.5 - Synchronising handlers in multithreaded programs">tutorial Timer.5</a>, <a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.http_server_3">HTTP server 3 example</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="threads.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="buffers.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,121 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Streams, Short Reads and Short Writes</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="buffers.html" title="Buffers">
|
||||
<link rel="next" href="reactor.html" title="Reactor-Style Operations">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="buffers.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="reactor.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.streams"></a><a class="link" href="streams.html" title="Streams, Short Reads and Short Writes">Streams, Short Reads and
|
||||
Short Writes</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Many I/O objects in Asio are stream-oriented. This means that:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
There are no message boundaries. The data being transferred is a continuous
|
||||
sequence of bytes.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Read or write operations may transfer fewer bytes than requested. This
|
||||
is referred to as a short read or short write.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Objects that provide stream-oriented I/O model one or more of the following
|
||||
type requirements:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SyncReadStream</span></code>, where
|
||||
synchronous read operations are performed using a member function called
|
||||
<code class="computeroutput"><span class="identifier">read_some</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">AsyncReadStream</span></code>, where
|
||||
asynchronous read operations are performed using a member function
|
||||
called <code class="computeroutput"><span class="identifier">async_read_some</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SyncWriteStream</span></code>, where
|
||||
synchronous write operations are performed using a member function
|
||||
called <code class="computeroutput"><span class="identifier">write_some</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">AsyncWriteStream</span></code>, where
|
||||
synchronous write operations are performed using a member function
|
||||
called <code class="computeroutput"><span class="identifier">async_write_some</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Examples of stream-oriented I/O objects include <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special"><></span></code>,
|
||||
<code class="computeroutput"><span class="identifier">posix</span><span class="special">::</span><span class="identifier">stream_descriptor</span></code>, <code class="computeroutput"><span class="identifier">windows</span><span class="special">::</span><span class="identifier">stream_handle</span></code>,
|
||||
etc.
|
||||
</p>
|
||||
<p>
|
||||
Programs typically want to transfer an exact number of bytes. When a short
|
||||
read or short write occurs the program must restart the operation, and
|
||||
continue to do so until the required number of bytes has been transferred.
|
||||
Asio provides generic functions that do this automatically: <code class="computeroutput"><span class="identifier">read</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">async_read</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">write</span><span class="special">()</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">async_write</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.streams.h0"></a>
|
||||
<span><a name="asio.overview.core.streams.why_eof_is_an_error"></a></span><a class="link" href="streams.html#asio.overview.core.streams.why_eof_is_an_error">Why
|
||||
EOF is an Error</a>
|
||||
</h6>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The end of a stream can cause <code class="computeroutput"><span class="identifier">read</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">async_read</span></code>, <code class="computeroutput"><span class="identifier">read_until</span></code> or <code class="computeroutput"><span class="identifier">async_read_until</span></code>
|
||||
functions to violate their contract. E.g. a read of N bytes may finish
|
||||
early due to EOF.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An EOF error may be used to distinguish the end of a stream from a
|
||||
successful read of size 0.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.streams.h1"></a>
|
||||
<span><a name="asio.overview.core.streams.see_also"></a></span><a class="link" href="streams.html#asio.overview.core.streams.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/async_read.html" title="async_read">async_read()</a>, <a class="link" href="../../reference/async_write.html" title="async_write">async_write()</a>,
|
||||
<a class="link" href="../../reference/read.html" title="read">read()</a>, <a class="link" href="../../reference/write.html" title="write">write()</a>,
|
||||
<a class="link" href="../../reference/AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
<a class="link" href="../../reference/AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">AsyncWriteStream</a>,
|
||||
<a class="link" href="../../reference/SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">SyncReadStream</a>, <a class="link" href="../../reference/SyncWriteStream.html" title="Buffer-oriented synchronous write stream requirements">SyncWriteStream</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="buffers.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="reactor.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,124 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Threads and Asio</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
|
||||
<link rel="prev" href="async.html" title="The Proactor Design Pattern: Concurrency Without Threads">
|
||||
<link rel="next" href="strands.html" title="Strands: Use Threads Without Explicit Locking">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="strands.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.core.threads"></a><a class="link" href="threads.html" title="Threads and Asio">Threads and Asio</a>
|
||||
</h4></div></div></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.threads.h0"></a>
|
||||
<span><a name="asio.overview.core.threads.thread_safety"></a></span><a class="link" href="threads.html#asio.overview.core.threads.thread_safety">Thread
|
||||
Safety</a>
|
||||
</h6>
|
||||
<p>
|
||||
In general, it is safe to make concurrent use of distinct objects, but
|
||||
unsafe to make concurrent use of a single object. However, types such as
|
||||
<code class="computeroutput"><span class="identifier">io_service</span></code> provide a stronger
|
||||
guarantee that it is safe to use a single object concurrently.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.threads.h1"></a>
|
||||
<span><a name="asio.overview.core.threads.thread_pools"></a></span><a class="link" href="threads.html#asio.overview.core.threads.thread_pools">Thread
|
||||
Pools</a>
|
||||
</h6>
|
||||
<p>
|
||||
Multiple threads may call <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code> to set up a pool of threads from which
|
||||
completion handlers may be invoked. This approach may also be used with
|
||||
<code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">post</span><span class="special">()</span></code>
|
||||
to use a means to perform any computational tasks across a thread pool.
|
||||
</p>
|
||||
<p>
|
||||
Note that all threads that have joined an <code class="computeroutput"><span class="identifier">io_service</span></code>'s
|
||||
pool are considered equivalent, and the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
may distribute work across them in an arbitrary fashion.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.core.threads.h2"></a>
|
||||
<span><a name="asio.overview.core.threads.internal_threads"></a></span><a class="link" href="threads.html#asio.overview.core.threads.internal_threads">Internal
|
||||
Threads</a>
|
||||
</h6>
|
||||
<p>
|
||||
The implementation of this library for a particular platform may make use
|
||||
of one or more internal threads to emulate asynchronicity. As far as possible,
|
||||
these threads must be invisible to the library user. In particular, the
|
||||
threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
must not call the user's code directly; and
|
||||
</li>
|
||||
<li class="listitem">
|
||||
must block all signals.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This approach is complemented by the following guarantee:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Asynchronous completion handlers will only be called from threads that
|
||||
are currently calling <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Consequently, it is the library user's responsibility to create and manage
|
||||
all threads to which the notifications will be delivered.
|
||||
</p>
|
||||
<p>
|
||||
The reasons for this approach include:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
By only calling <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code> from a single thread, the user's
|
||||
code can avoid the development complexity associated with synchronisation.
|
||||
For example, a library user can implement scalable servers that are
|
||||
single-threaded (from the user's point of view).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
A library user may need to perform initialisation in a thread shortly
|
||||
after the thread starts and before any other application code is executed.
|
||||
For example, users of Microsoft's COM must call <code class="computeroutput"><span class="identifier">CoInitializeEx</span></code>
|
||||
before any other COM operations can be called from that thread.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The library interface is decoupled from interfaces for thread creation
|
||||
and management, and permits implementations on platforms where threads
|
||||
are not available.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h6>
|
||||
<a name="asio.overview.core.threads.h3"></a>
|
||||
<span><a name="asio.overview.core.threads.see_also"></a></span><a class="link" href="threads.html#asio.overview.core.threads.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/io_service.html" title="io_service">io_service</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="strands.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,65 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>C++ 2011 Support</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="ssl.html" title="SSL">
|
||||
<link rel="next" href="cpp2011/system_error.html" title="System Errors and Error Codes">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ssl.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp2011/system_error.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.cpp2011"></a><a class="link" href="cpp2011.html" title="C++ 2011 Support">C++ 2011 Support</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/system_error.html" title="System Errors and Error Codes">System Errors and Error
|
||||
Codes</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/move_objects.html" title="Movable I/O Objects">Movable I/O Objects</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/move_handlers.html" title="Movable Handlers">Movable Handlers</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/variadic.html" title="Variadic Templates">Variadic Templates</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/array.html" title="Array Container">Array Container</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/atomic.html" title="Atomics">Atomics</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/shared_ptr.html" title="Shared Pointers">Shared Pointers</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/chrono.html" title="Chrono">Chrono</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="cpp2011/futures.html" title="Futures">Futures</a>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ssl.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp2011/system_error.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,63 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Array Container</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="variadic.html" title="Variadic Templates">
|
||||
<link rel="next" href="atomic.html" title="Atomics">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="variadic.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="atomic.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.array"></a><a class="link" href="array.html" title="Array Container">Array Container</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Where the standard library provides <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">array</span><span class="special"><></span></code>, Asio:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Provides overloads for the <a class="link" href="../../reference/buffer.html" title="buffer">buffer()</a>
|
||||
function.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Uses it in preference to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span><span class="special"><></span></code> for the <a class="link" href="../../reference/ip__address_v4/bytes_type.html" title="ip::address_v4::bytes_type">ip::address_v4::bytes_type</a>
|
||||
and <a class="link" href="../../reference/ip__address_v6/bytes_type.html" title="ip::address_v6::bytes_type">ip::address_v6::bytes_type</a>
|
||||
types.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Uses it in preference to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span><span class="special"><></span></code> where a fixed size array type
|
||||
is needed in the implementation.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Support for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">array</span><span class="special"><></span></code>
|
||||
is automatically enabled for <code class="literal">g++</code> 4.3 and later, when
|
||||
the <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code> compiler
|
||||
options are used, as well as for Microsoft Visual C++ 10. It may be disabled
|
||||
by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_STD_ARRAY</span></code>,
|
||||
or explicitly enabled for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_STD_ARRAY</span></code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="variadic.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="atomic.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Atomics</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="array.html" title="Array Container">
|
||||
<link rel="next" href="shared_ptr.html" title="Shared Pointers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="array.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="shared_ptr.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.atomic"></a><a class="link" href="atomic.html" title="Atomics">Atomics</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio's implementation can use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">atomic</span><span class="special"><></span></code> in preference to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">detail</span><span class="special">::</span><span class="identifier">atomic_count</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
Support for the standard atomic integer template is automatically enabled
|
||||
for <code class="literal">g++</code> 4.5 and later, when the <code class="literal">-std=c++0x</code>
|
||||
or <code class="literal">-std=gnu++0x</code> compiler options are used. It may be
|
||||
disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_STD_ATOMIC</span></code>,
|
||||
or explicitly enabled for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_STD_ATOMIC</span></code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="array.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="shared_ptr.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,59 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Chrono</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="shared_ptr.html" title="Shared Pointers">
|
||||
<link rel="next" href="futures.html" title="Futures">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="shared_ptr.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="futures.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.chrono"></a><a class="link" href="chrono.html" title="Chrono">Chrono</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio provides timers based on the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span></code>
|
||||
facilities via the <a class="link" href="../../reference/basic_waitable_timer.html" title="basic_waitable_timer">basic_waitable_timer</a>
|
||||
class template. The typedefs <a class="link" href="../../reference/system_timer.html" title="system_timer">system_timer</a>,
|
||||
<a class="link" href="../../reference/steady_timer.html" title="steady_timer">steady_timer</a> and <a class="link" href="../../reference/high_resolution_timer.html" title="high_resolution_timer">high_resolution_timer</a>
|
||||
utilise the standard clocks <code class="computeroutput"><span class="identifier">system_clock</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">steady_clock</span></code> and <code class="computeroutput"><span class="identifier">high_resolution_clock</span></code> respectively.
|
||||
</p>
|
||||
<p>
|
||||
Support for the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span></code> facilities is automatically enabled
|
||||
for <code class="literal">g++</code> 4.6 and later, when the <code class="literal">-std=c++0x</code>
|
||||
or <code class="literal">-std=gnu++0x</code> compiler options are used. (Note that,
|
||||
for <code class="literal">g++</code>, the draft-standard <code class="computeroutput"><span class="identifier">monotonic_clock</span></code>
|
||||
is used in place of <code class="computeroutput"><span class="identifier">steady_clock</span></code>.)
|
||||
Support may be disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_STD_CHRONO</span></code>,
|
||||
or explicitly enabled for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_STD_CHRONO</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
When standard <code class="computeroutput"><span class="identifier">chrono</span></code> is
|
||||
unavailable, Asio will otherwise use the Boost.Chrono library. The <a class="link" href="../../reference/basic_waitable_timer.html" title="basic_waitable_timer">basic_waitable_timer</a>
|
||||
class template may be used with either.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="shared_ptr.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="futures.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,76 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Futures</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="chrono.html" title="Chrono">
|
||||
<link rel="next" href="../implementation.html" title="Platform-Specific Implementation Notes">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="chrono.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../implementation.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.futures"></a><a class="link" href="futures.html" title="Futures">Futures</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span></code> special value provides first-class
|
||||
support for returning a C++11 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span></code>
|
||||
from an asynchronous operation's initiating function.
|
||||
</p>
|
||||
<p>
|
||||
To use <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span></code>, pass it to an asynchronous
|
||||
operation instead of a normal completion handler. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">></span> <span class="identifier">length</span> <span class="special">=</span>
|
||||
<span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Where a handler signature has the form:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="identifier">result_type</span> <span class="identifier">result</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
the initiating function returns a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span></code>
|
||||
templated on <code class="computeroutput"><span class="identifier">result_type</span></code>.
|
||||
In the above example, this is <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>.
|
||||
If the asynchronous operation fails, the <code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
is converted into a <code class="computeroutput"><span class="identifier">system_error</span></code>
|
||||
exception and passed back to the caller through the future.
|
||||
</p>
|
||||
<p>
|
||||
Where a handler signature has the form:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
the initiating function returns <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span><span class="special"><</span><span class="keyword">void</span><span class="special">></span></code>. As above, an error is passed back
|
||||
in the future as a <code class="computeroutput"><span class="identifier">system_error</span></code>
|
||||
exception.
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/use_future.html" title="use_future">use_future</a>, <a class="link" href="../../reference/use_future_t.html" title="use_future_t">use_future_t</a>,
|
||||
<a class="link" href="../../examples/cpp11_examples.html#asio.examples.cpp11_examples.futures">Futures example (C++11)</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="chrono.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../implementation.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,83 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Movable Handlers</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="move_objects.html" title="Movable I/O Objects">
|
||||
<link rel="next" href="variadic.html" title="Variadic Templates">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="move_objects.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="variadic.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.move_handlers"></a><a class="link" href="move_handlers.html" title="Movable Handlers">Movable Handlers</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
As an optimisation, user-defined completion handlers may provide move constructors,
|
||||
and Asio's implementation will use a handler's move constructor in preference
|
||||
to its copy constructor. In certain circumstances, Asio may be able to
|
||||
eliminate all calls to a handler's copy constructor. However, handler types
|
||||
are still required to be copy constructible.
|
||||
</p>
|
||||
<p>
|
||||
When move support is enabled, asynchronous that are documented as follows:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Handler</span><span class="special">></span>
|
||||
<span class="keyword">void</span> <span class="identifier">async_XYZ</span><span class="special">(...,</span> <span class="identifier">Handler</span> <span class="identifier">handler</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
are actually declared as:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Handler</span><span class="special">></span>
|
||||
<span class="keyword">void</span> <span class="identifier">async_XYZ</span><span class="special">(...,</span> <span class="identifier">Handler</span><span class="special">&&</span> <span class="identifier">handler</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
The handler argument is perfectly forwarded and the move construction occurs
|
||||
within the body of <code class="computeroutput"><span class="identifier">async_XYZ</span><span class="special">()</span></code>. This ensures that all other function
|
||||
arguments are evaluated prior to the move. This is critical when the other
|
||||
arguments to <code class="computeroutput"><span class="identifier">async_XYZ</span><span class="special">()</span></code> are members of the handler. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">my_operation</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">shared_ptr</span><span class="special"><</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">></span> <span class="identifier">socket</span><span class="special">;</span>
|
||||
<span class="identifier">shared_ptr</span><span class="special"><</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">>></span> <span class="identifier">buffer</span><span class="special">;</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">(</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">length</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">socket</span><span class="special">-></span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(*</span><span class="identifier">buffer</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(*</span><span class="keyword">this</span><span class="special">));</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
Move support is automatically enabled for <code class="literal">g++</code> 4.5 and
|
||||
later, when the <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code>
|
||||
compiler options are used. It may be disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_MOVE</span></code>, or explicitly enabled
|
||||
for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_MOVE</span></code>.
|
||||
Note that these macros also affect the availability of <a class="link" href="move_objects.html" title="Movable I/O Objects">movable
|
||||
I/O objects</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="move_objects.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="variadic.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,103 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Movable I/O Objects</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="system_error.html" title="System Errors and Error Codes">
|
||||
<link rel="next" href="move_handlers.html" title="Movable Handlers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="system_error.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="move_handlers.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.move_objects"></a><a class="link" href="move_objects.html" title="Movable I/O Objects">Movable I/O Objects</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
When move support is available (via rvalue references), Asio allows move
|
||||
construction and assignment of sockets, serial ports, POSIX descriptors
|
||||
and Windows handles.
|
||||
</p>
|
||||
<p>
|
||||
Move support allows you to write code like:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">make_socket</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">&</span> <span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">s</span><span class="special">(</span><span class="identifier">i</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">s</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
or:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">connection</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">enable_shared_from_this</span><span class="special"><</span><span class="identifier">connection</span><span class="special">></span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">private</span><span class="special">:</span>
|
||||
<span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket_</span><span class="special">;</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="identifier">connection</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&&</span> <span class="identifier">s</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">socket_</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">s</span><span class="special">))</span> <span class="special">{}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="special">...</span>
|
||||
|
||||
<span class="keyword">class</span> <span class="identifier">server</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">private</span><span class="special">:</span>
|
||||
<span class="identifier">tcp</span><span class="special">::</span><span class="identifier">acceptor</span> <span class="identifier">acceptor_</span><span class="special">;</span>
|
||||
<span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket_</span><span class="special">;</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="identifier">handle_accept</span><span class="special">(</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(!</span><span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">make_shared</span><span class="special"><</span><span class="identifier">connection</span><span class="special">>(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">socket_</span><span class="special">))-></span><span class="identifier">go</span><span class="special">();</span>
|
||||
<span class="identifier">acceptor_</span><span class="special">.</span><span class="identifier">async_accept</span><span class="special">(</span><span class="identifier">socket_</span><span class="special">,</span> <span class="special">...);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
as well as:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">></span> <span class="identifier">sockets</span><span class="special">;</span>
|
||||
<span class="identifier">sockets</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">(...));</span>
|
||||
</pre>
|
||||
<p>
|
||||
A word of warning: There is nothing stopping you from moving these objects
|
||||
while there are pending asynchronous operations, but it is unlikely to
|
||||
be a good idea to do so. In particular, composed operations like <a class="link" href="../../reference/async_read.html" title="async_read">async_read()</a> store a reference
|
||||
to the stream object. Moving during the composed operation means that the
|
||||
composed operation may attempt to access a moved-from object.
|
||||
</p>
|
||||
<p>
|
||||
Move support is automatically enabled for <code class="literal">g++</code> 4.5 and
|
||||
later, when the <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code>
|
||||
compiler options are used. It may be disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_MOVE</span></code>, or explicitly enabled
|
||||
for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_MOVE</span></code>.
|
||||
Note that these macros also affect the availability of <a class="link" href="move_handlers.html" title="Movable Handlers">movable
|
||||
handlers</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="system_error.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="move_handlers.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Shared Pointers</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="atomic.html" title="Atomics">
|
||||
<link rel="next" href="chrono.html" title="Chrono">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="atomic.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="chrono.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.shared_ptr"></a><a class="link" href="shared_ptr.html" title="Shared Pointers">Shared Pointers</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio's implementation can use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special"><></span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">weak_ptr</span><span class="special"><></span></code> in preference to the Boost equivalents.
|
||||
</p>
|
||||
<p>
|
||||
Support for the standard smart pointers is automatically enabled for <code class="literal">g++</code>
|
||||
4.3 and later, when the <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code>
|
||||
compiler options are used, as well as for Microsoft Visual C++ 10. It may
|
||||
be disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_STD_SHARED_PTR</span></code>,
|
||||
or explicitly enabled for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_STD_SHARED_PTR</span></code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="atomic.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="chrono.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,51 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>System Errors and Error Codes</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="next" href="move_objects.html" title="Movable I/O Objects">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../cpp2011.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="move_objects.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.system_error"></a><a class="link" href="system_error.html" title="System Errors and Error Codes">System Errors and
|
||||
Error Codes</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
When available, Asio can use the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">system_error</span></code> classes for reporting errors.
|
||||
In this case, the names <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">system_error</span></code> will be typedefs for these
|
||||
standard classes.
|
||||
</p>
|
||||
<p>
|
||||
System error support is automatically enabled for <code class="literal">g++</code>
|
||||
4.6 and later, when the <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code>
|
||||
compiler options are used. It may be disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_STD_SYSTEM_ERROR</span></code>, or explicitly
|
||||
enabled for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_STD_SYSTEM_ERROR</span></code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../cpp2011.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="move_objects.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,49 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Variadic Templates</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../cpp2011.html" title="C++ 2011 Support">
|
||||
<link rel="prev" href="move_handlers.html" title="Movable Handlers">
|
||||
<link rel="next" href="array.html" title="Array Container">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="move_handlers.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="array.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.cpp2011.variadic"></a><a class="link" href="variadic.html" title="Variadic Templates">Variadic Templates</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
When supported by a compiler, Asio can use variadic templates to implement
|
||||
the <a class="link" href="../../reference/basic_socket_streambuf/connect.html" title="basic_socket_streambuf::connect">basic_socket_streambuf::connect()</a>
|
||||
and <a class="link" href="../../reference/basic_socket_iostream/connect.html" title="basic_socket_iostream::connect">basic_socket_iostream::connect()</a>
|
||||
functions.
|
||||
</p>
|
||||
<p>
|
||||
Support for variadic templates is automatically enabled for <code class="literal">g++</code>
|
||||
4.3 and later, when the <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code>
|
||||
compiler options are used. It may be disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_VARIADIC_TEMPLATES</span></code>, or explicitly
|
||||
enabled for other compilers by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_VARIADIC_TEMPLATES</span></code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="move_handlers.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../cpp2011.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="array.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,494 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Platform-Specific Implementation Notes</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="cpp2011/futures.html" title="Futures">
|
||||
<link rel="next" href="../using.html" title="Using Asio">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="cpp2011/futures.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../using.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.implementation"></a><a class="link" href="implementation.html" title="Platform-Specific Implementation Notes">Platform-Specific Implementation
|
||||
Notes</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
This section lists platform-specific implementation details, such as the
|
||||
default demultiplexing mechanism, the number of threads created internally,
|
||||
and when threads are created.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h0"></a>
|
||||
<span><a name="asio.overview.implementation.linux_kernel_2_4"></a></span><a class="link" href="implementation.html#asio.overview.implementation.linux_kernel_2_4">Linux
|
||||
Kernel 2.4</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">select</span></code> for demultiplexing.
|
||||
This means that the number of file descriptors in the process cannot
|
||||
be permitted to exceed <code class="computeroutput"><span class="identifier">FD_SETSIZE</span></code>.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">select</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h1"></a>
|
||||
<span><a name="asio.overview.implementation.linux_kernel_2_6"></a></span><a class="link" href="implementation.html#asio.overview.implementation.linux_kernel_2_6">Linux
|
||||
Kernel 2.6</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">epoll</span></code> for demultiplexing.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">epoll</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h2"></a>
|
||||
<span><a name="asio.overview.implementation.solaris"></a></span><a class="link" href="implementation.html#asio.overview.implementation.solaris">Solaris</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="literal">/dev/poll</code> for demultiplexing.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="literal">/dev/poll</code> is performed in one
|
||||
of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h3"></a>
|
||||
<span><a name="asio.overview.implementation.qnx_neutrino"></a></span><a class="link" href="implementation.html#asio.overview.implementation.qnx_neutrino">QNX
|
||||
Neutrino</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">select</span></code> for demultiplexing.
|
||||
This means that the number of file descriptors in the process cannot
|
||||
be permitted to exceed <code class="computeroutput"><span class="identifier">FD_SETSIZE</span></code>.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">select</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h4"></a>
|
||||
<span><a name="asio.overview.implementation.mac_os_x"></a></span><a class="link" href="implementation.html#asio.overview.implementation.mac_os_x">Mac
|
||||
OS X</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">kqueue</span></code> for demultiplexing.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">kqueue</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h5"></a>
|
||||
<span><a name="asio.overview.implementation.freebsd"></a></span><a class="link" href="implementation.html#asio.overview.implementation.freebsd">FreeBSD</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">kqueue</span></code> for demultiplexing.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">kqueue</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h6"></a>
|
||||
<span><a name="asio.overview.implementation.aix"></a></span><a class="link" href="implementation.html#asio.overview.implementation.aix">AIX</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">select</span></code> for demultiplexing.
|
||||
This means that the number of file descriptors in the process cannot
|
||||
be permitted to exceed <code class="computeroutput"><span class="identifier">FD_SETSIZE</span></code>.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">select</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h7"></a>
|
||||
<span><a name="asio.overview.implementation.hp_ux"></a></span><a class="link" href="implementation.html#asio.overview.implementation.hp_ux">HP-UX</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">select</span></code> for demultiplexing.
|
||||
This means that the number of file descriptors in the process cannot
|
||||
be permitted to exceed <code class="computeroutput"><span class="identifier">FD_SETSIZE</span></code>.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">select</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h8"></a>
|
||||
<span><a name="asio.overview.implementation.tru64"></a></span><a class="link" href="implementation.html#asio.overview.implementation.tru64">Tru64</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">select</span></code> for demultiplexing.
|
||||
This means that the number of file descriptors in the process cannot
|
||||
be permitted to exceed <code class="computeroutput"><span class="identifier">FD_SETSIZE</span></code>.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">select</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
At most <code class="computeroutput"><span class="identifier">min</span><span class="special">(</span><span class="number">64</span><span class="special">,</span><span class="identifier">IOV_MAX</span><span class="special">)</span></code> buffers may be transferred in a single
|
||||
operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h9"></a>
|
||||
<span><a name="asio.overview.implementation.windows_95__98_and_me"></a></span><a class="link" href="implementation.html#asio.overview.implementation.windows_95__98_and_me">Windows
|
||||
95, 98 and Me</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">select</span></code> for demultiplexing.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using <code class="computeroutput"><span class="identifier">select</span></code>
|
||||
is performed in one of the threads that calls <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
For sockets, at most 16 buffers may be transferred in a single operation.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h10"></a>
|
||||
<span><a name="asio.overview.implementation.windows_nt__2000__xp__2003__vista__7_and_8"></a></span><a class="link" href="implementation.html#asio.overview.implementation.windows_nt__2000__xp__2003__vista__7_and_8">Windows
|
||||
NT, 2000, XP, 2003, Vista, 7 and 8</a>
|
||||
</h5>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Uses overlapped I/O and I/O completion ports for all asynchronous socket
|
||||
operations except for asynchronous connect.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Uses <code class="computeroutput"><span class="identifier">select</span></code> for emulating
|
||||
asynchronous connect.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Demultiplexing using I/O completion ports is performed in all threads
|
||||
that call <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">poll_one</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to trigger timers. This thread is created on construction of
|
||||
the first <code class="computeroutput"><span class="identifier">deadline_timer</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">deadline_timer_service</span></code>
|
||||
objects.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used for the <code class="computeroutput"><span class="identifier">select</span></code>
|
||||
demultiplexing. This thread is created on the first call to <code class="computeroutput"><span class="identifier">async_connect</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to emulate asynchronous host resolution. This thread is created
|
||||
on the first call to either <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">async_resolve</span><span class="special">()</span></code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
For sockets, at most 64 buffers may be transferred in a single operation.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
For stream-oriented handles, only one buffer may be transferred in a
|
||||
single operation.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.overview.implementation.h11"></a>
|
||||
<span><a name="asio.overview.implementation.windows_runtime"></a></span><a class="link" href="implementation.html#asio.overview.implementation.windows_runtime">Windows
|
||||
Runtime</a>
|
||||
</h5>
|
||||
<p>
|
||||
Asio provides limited support for the Windows Runtime. It requires that the
|
||||
language extensions be enabled. Due to the restricted facilities exposed
|
||||
by the Windows Runtime API, the support comes with the following caveats:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The core facilities such as the <code class="computeroutput"><span class="identifier">io_service</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">strand</span></code>, buffers, composed
|
||||
operations, timers, etc., should all work as normal.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
For sockets, only client-side TCP is supported.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Explicit binding of a client-side TCP socket is not supported.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The <code class="computeroutput"><span class="identifier">cancel</span><span class="special">()</span></code>
|
||||
function is not supported for sockets. Asynchronous operations may only
|
||||
be cancelled by closing the socket.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Operations that use <code class="computeroutput"><span class="identifier">null_buffers</span></code>
|
||||
are not supported.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Only <code class="computeroutput"><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">no_delay</span></code> and <code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">keep_alive</span></code>
|
||||
options are supported.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Resolvers do not support service names, only numbers. I.e. you must use
|
||||
"80" rather than "http".
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Most resolver query flags have no effect.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Demultiplexing mechanism:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
Uses the <code class="computeroutput"><span class="identifier">Windows</span><span class="special">::</span><span class="identifier">Networking</span><span class="special">::</span><span class="identifier">Sockets</span><span class="special">::</span><span class="identifier">StreamSocket</span></code> class to implement asynchronous
|
||||
TCP socket operations.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
Threads:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Event completions are delivered to the Windows thread pool and posted
|
||||
to the <code class="computeroutput"><span class="identifier">io_service</span></code> for
|
||||
the handler to be executed.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An additional thread per <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
is used to trigger timers. This thread is created on construction of
|
||||
the first timer objects.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Scatter-Gather:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
For sockets, at most one buffer may be transferred in a single operation.
|
||||
</li></ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="cpp2011/futures.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../using.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Networking</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="core/spawn.html" title="Stackful Coroutines">
|
||||
<link rel="next" href="networking/protocols.html" title="TCP, UDP and ICMP">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="core/spawn.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="networking/protocols.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.networking"></a><a class="link" href="networking.html" title="Networking">Networking</a>
|
||||
</h3></div></div></div>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a class="link" href="networking/protocols.html" title="TCP, UDP and ICMP">TCP, UDP and ICMP</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="networking/other_protocols.html" title="Support for Other Protocols">Support for
|
||||
Other Protocols</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="networking/iostreams.html" title="Socket Iostreams">Socket Iostreams</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="networking/bsd_sockets.html" title="The BSD Socket API and Asio">The BSD Socket API
|
||||
and Asio</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="core/spawn.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="networking/protocols.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,556 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>The BSD Socket API and Asio</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../networking.html" title="Networking">
|
||||
<link rel="prev" href="iostreams.html" title="Socket Iostreams">
|
||||
<link rel="next" href="../timers.html" title="Timers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="iostreams.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../timers.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.networking.bsd_sockets"></a><a class="link" href="bsd_sockets.html" title="The BSD Socket API and Asio">The BSD Socket
|
||||
API and Asio</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
The Asio library includes a low-level socket interface based on the BSD
|
||||
socket API, which is widely implemented and supported by extensive literature.
|
||||
It is also used as the basis for networking APIs in other languages, like
|
||||
Java. This low-level interface is designed to support the development of
|
||||
efficient and scalable applications. For example, it permits programmers
|
||||
to exert finer control over the number of system calls, avoid redundant
|
||||
data copying, minimise the use of resources like threads, and so on.
|
||||
</p>
|
||||
<p>
|
||||
Unsafe and error prone aspects of the BSD socket API not included. For
|
||||
example, the use of <code class="computeroutput"><span class="keyword">int</span></code> to
|
||||
represent all sockets lacks type safety. The socket representation in Asio
|
||||
uses a distinct type for each protocol, e.g. for TCP one would use <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code>, and for UDP one uses <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">socket</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The following table shows the mapping between the BSD socket API and Asio:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
BSD Socket API Elements
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Equivalents in Asio
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
socket descriptor - <code class="computeroutput"><span class="keyword">int</span></code>
|
||||
(POSIX) or <code class="computeroutput"><span class="identifier">SOCKET</span></code>
|
||||
(Windows)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/ip__tcp/socket.html" title="ip::tcp::socket">ip::tcp::socket</a>,
|
||||
<a class="link" href="../../reference/ip__tcp/acceptor.html" title="ip::tcp::acceptor">ip::tcp::acceptor</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/ip__udp/socket.html" title="ip::udp::socket">ip::udp::socket</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket.html" title="basic_socket">basic_socket</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket.html" title="basic_stream_socket">basic_stream_socket</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket.html" title="basic_datagram_socket">basic_datagram_socket</a>,
|
||||
<a class="link" href="../../reference/basic_raw_socket.html" title="basic_raw_socket">basic_raw_socket</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">in_addr</span></code>, <code class="computeroutput"><span class="identifier">in6_addr</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__address.html" title="ip::address">ip::address</a>,
|
||||
<a class="link" href="../../reference/ip__address.html" title="ip::address">ip::address_v4</a>,
|
||||
<a class="link" href="../../reference/ip__address.html" title="ip::address">ip::address_v6</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">sockaddr_in</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">sockaddr_in6</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/ip__tcp/endpoint.html" title="ip::tcp::endpoint">ip::tcp::endpoint</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/ip__udp/endpoint.html" title="ip::udp::endpoint">ip::udp::endpoint</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__basic_endpoint.html" title="ip::basic_endpoint">ip::basic_endpoint</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket_acceptor/accept.html" title="basic_socket_acceptor::accept">ip::tcp::acceptor::accept()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket_acceptor/accept.html" title="basic_socket_acceptor::accept">basic_socket_acceptor::accept()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/bind.html" title="basic_socket::bind">ip::tcp::acceptor::bind()</a>,
|
||||
<a class="link" href="../../reference/basic_socket/bind.html" title="basic_socket::bind">ip::tcp::socket::bind()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/bind.html" title="basic_socket::bind">ip::udp::socket::bind()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/bind.html" title="basic_socket::bind">basic_socket::bind()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">close</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/close.html" title="basic_socket::close">ip::tcp::acceptor::close()</a>,
|
||||
<a class="link" href="../../reference/basic_socket/close.html" title="basic_socket::close">ip::tcp::socket::close()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/close.html" title="basic_socket::close">ip::udp::socket::close()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/close.html" title="basic_socket::close">basic_socket::close()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/connect.html" title="basic_socket::connect">ip::tcp::socket::connect()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/connect.html" title="basic_socket::connect">ip::udp::socket::connect()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/connect.html" title="basic_socket::connect">basic_socket::connect()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">getaddrinfo</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">gethostbyaddr</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">gethostbyname</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">getnameinfo</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">getservbyname</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">getservbyport</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/ip__basic_resolver/resolve.html" title="ip::basic_resolver::resolve">ip::tcp::resolver::resolve()</a>,
|
||||
<a class="link" href="../../reference/ip__basic_resolver/async_resolve.html" title="ip::basic_resolver::async_resolve">ip::tcp::resolver::async_resolve()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/ip__basic_resolver/resolve.html" title="ip::basic_resolver::resolve">ip::udp::resolver::resolve()</a>,
|
||||
<a class="link" href="../../reference/ip__basic_resolver/async_resolve.html" title="ip::basic_resolver::async_resolve">ip::udp::resolver::async_resolve()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__basic_resolver/resolve.html" title="ip::basic_resolver::resolve">ip::basic_resolver::resolve()</a>,
|
||||
<a class="link" href="../../reference/ip__basic_resolver/async_resolve.html" title="ip::basic_resolver::async_resolve">ip::basic_resolver::async_resolve()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">gethostname</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__host_name.html" title="ip::host_name">ip::host_name()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">getpeername</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/remote_endpoint.html" title="basic_socket::remote_endpoint">ip::tcp::socket::remote_endpoint()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/remote_endpoint.html" title="basic_socket::remote_endpoint">ip::udp::socket::remote_endpoint()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/remote_endpoint.html" title="basic_socket::remote_endpoint">basic_socket::remote_endpoint()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">getsockname</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/local_endpoint.html" title="basic_socket::local_endpoint">ip::tcp::acceptor::local_endpoint()</a>,
|
||||
<a class="link" href="../../reference/basic_socket/local_endpoint.html" title="basic_socket::local_endpoint">ip::tcp::socket::local_endpoint()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/local_endpoint.html" title="basic_socket::local_endpoint">ip::udp::socket::local_endpoint()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/local_endpoint.html" title="basic_socket::local_endpoint">basic_socket::local_endpoint()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/get_option.html" title="basic_socket::get_option">ip::tcp::acceptor::get_option()</a>,
|
||||
<a class="link" href="../../reference/basic_socket/get_option.html" title="basic_socket::get_option">ip::tcp::socket::get_option()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/get_option.html" title="basic_socket::get_option">ip::udp::socket::get_option()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/get_option.html" title="basic_socket::get_option">basic_socket::get_option()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">inet_addr</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">inet_aton</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">inet_pton</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__address/from_string.html" title="ip::address::from_string">ip::address::from_string()</a>,
|
||||
<a class="link" href="../../reference/ip__address/from_string.html" title="ip::address::from_string">ip::address_v4::from_string()</a>,
|
||||
<a class="link" href="../../reference/ip__address/from_string.html" title="ip::address::from_string">ip_address_v6::from_string()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">inet_ntoa</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">inet_ntop</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__address/to_string.html" title="ip::address::to_string">ip::address::to_string()</a>,
|
||||
<a class="link" href="../../reference/ip__address/to_string.html" title="ip::address::to_string">ip::address_v4::to_string()</a>,
|
||||
<a class="link" href="../../reference/ip__address/to_string.html" title="ip::address::to_string">ip_address_v6::to_string()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">ioctl</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/io_control.html" title="basic_socket::io_control">ip::tcp::socket::io_control()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/io_control.html" title="basic_socket::io_control">ip::udp::socket::io_control()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/io_control.html" title="basic_socket::io_control">basic_socket::io_control()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">listen</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket_acceptor/listen.html" title="basic_socket_acceptor::listen">ip::tcp::acceptor::listen()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket_acceptor/listen.html" title="basic_socket_acceptor::listen">basic_socket_acceptor::listen()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">select</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">pselect</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../../reference/io_service/run.html" title="io_service::run">io_service::run()</a>,
|
||||
<a class="link" href="../../reference/io_service/run_one.html" title="io_service::run_one">io_service::run_one()</a>,
|
||||
<a class="link" href="../../reference/io_service/poll.html" title="io_service::poll">io_service::poll()</a>,
|
||||
<a class="link" href="../../reference/io_service/poll_one.html" title="io_service::poll_one">io_service::poll_one()</a>
|
||||
</p>
|
||||
<p>
|
||||
Note: in conjunction with asynchronous operations.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">readv</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">recv</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">read</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_stream_socket/read_some.html" title="basic_stream_socket::read_some">ip::tcp::socket::read_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_read_some.html" title="basic_stream_socket::async_read_some">ip::tcp::socket::async_read_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/receive.html" title="basic_stream_socket::receive">ip::tcp::socket::receive()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_receive.html" title="basic_stream_socket::async_receive">ip::tcp::socket::async_receive()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_datagram_socket/receive.html" title="basic_datagram_socket::receive">ip::udp::socket::receive()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_receive.html" title="basic_datagram_socket::async_receive">ip::udp::socket::async_receive()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_stream_socket/read_some.html" title="basic_stream_socket::read_some">basic_stream_socket::read_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_read_some.html" title="basic_stream_socket::async_read_some">basic_stream_socket::async_read_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/receive.html" title="basic_stream_socket::receive">basic_stream_socket::receive()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_receive.html" title="basic_stream_socket::async_receive">basic_stream_socket::async_receive()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/receive.html" title="basic_datagram_socket::receive">basic_datagram_socket::receive()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_receive.html" title="basic_datagram_socket::async_receive">basic_datagram_socket::async_receive()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">recvfrom</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_datagram_socket/receive_from.html" title="basic_datagram_socket::receive_from">ip::udp::socket::receive_from()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_receive_from.html" title="basic_datagram_socket::async_receive_from">ip::udp::socket::async_receive_from()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_datagram_socket/receive_from.html" title="basic_datagram_socket::receive_from">basic_datagram_socket::receive_from()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_receive_from.html" title="basic_datagram_socket::async_receive_from">basic_datagram_socket::async_receive_from()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">send</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">write</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">writev</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_stream_socket/write_some.html" title="basic_stream_socket::write_some">ip::tcp::socket::write_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_write_some.html" title="basic_stream_socket::async_write_some">ip::tcp::socket::async_write_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/send.html" title="basic_stream_socket::send">ip::tcp::socket::send()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_send.html" title="basic_stream_socket::async_send">ip::tcp::socket::async_send()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_datagram_socket/send.html" title="basic_datagram_socket::send">ip::udp::socket::send()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_send.html" title="basic_datagram_socket::async_send">ip::udp::socket::async_send()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_stream_socket/write_some.html" title="basic_stream_socket::write_some">basic_stream_socket::write_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_write_some.html" title="basic_stream_socket::async_write_some">basic_stream_socket::async_write_some()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/send.html" title="basic_stream_socket::send">basic_stream_socket::send()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_send.html" title="basic_stream_socket::async_send">basic_stream_socket::async_send()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/send.html" title="basic_datagram_socket::send">basic_datagram_socket::send()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_send.html" title="basic_datagram_socket::async_send">basic_datagram_socket::async_send()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">sendto</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_datagram_socket/send_to.html" title="basic_datagram_socket::send_to">ip::udp::socket::send_to()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_send_to.html" title="basic_datagram_socket::async_send_to">ip::udp::socket::async_send_to()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_datagram_socket/send_to.html" title="basic_datagram_socket::send_to">basic_datagram_socket::send_to()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_send_to.html" title="basic_datagram_socket::async_send_to">basic_datagram_socket::async_send_to()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/set_option.html" title="basic_socket::set_option">ip::tcp::acceptor::set_option()</a>,
|
||||
<a class="link" href="../../reference/basic_socket/set_option.html" title="basic_socket::set_option">ip::tcp::socket::set_option()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/set_option.html" title="basic_socket::set_option">ip::udp::socket::set_option()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/set_option.html" title="basic_socket::set_option">basic_socket::set_option()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">shutdown</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/shutdown.html" title="basic_socket::shutdown">ip::tcp::socket::shutdown()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/shutdown.html" title="basic_socket::shutdown">ip::udp::socket::shutdown()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/shutdown.html" title="basic_socket::shutdown">basic_socket::shutdown()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">sockatmark</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/at_mark.html" title="basic_socket::at_mark">ip::tcp::socket::at_mark()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/at_mark.html" title="basic_socket::at_mark">basic_socket::at_mark()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For TCP: <a class="link" href="../../reference/basic_socket/open.html" title="basic_socket::open">ip::tcp::acceptor::open()</a>,
|
||||
<a class="link" href="../../reference/basic_socket/open.html" title="basic_socket::open">ip::tcp::socket::open()</a>
|
||||
</p>
|
||||
<p>
|
||||
For UDP: <a class="link" href="../../reference/basic_socket/open.html" title="basic_socket::open">ip::udp::socket::open()</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="../../reference/basic_socket/open.html" title="basic_socket::open">basic_socket::open()</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">socketpair</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../../reference/local__connect_pair.html" title="local::connect_pair">local::connect_pair()</a>
|
||||
</p>
|
||||
<p>
|
||||
Note: POSIX operating systems only.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="iostreams.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../timers.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,113 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Socket Iostreams</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../networking.html" title="Networking">
|
||||
<link rel="prev" href="other_protocols.html" title="Support for Other Protocols">
|
||||
<link rel="next" href="bsd_sockets.html" title="The BSD Socket API and Asio">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="other_protocols.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="bsd_sockets.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.networking.iostreams"></a><a class="link" href="iostreams.html" title="Socket Iostreams">Socket Iostreams</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio includes classes that implement iostreams on top of sockets. These
|
||||
hide away the complexities associated with endpoint resolution, protocol
|
||||
independence, etc. To create a connection one might simply write:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">iostream</span> <span class="identifier">stream</span><span class="special">(</span><span class="string">"www.boost.org"</span><span class="special">,</span> <span class="string">"http"</span><span class="special">);</span>
|
||||
<span class="keyword">if</span> <span class="special">(!</span><span class="identifier">stream</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// Can't connect.</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
The iostream class can also be used in conjunction with an acceptor to
|
||||
create simple servers. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">io_service</span> <span class="identifier">ios</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">endpoint</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">v4</span><span class="special">(),</span> <span class="number">80</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">acceptor</span> <span class="identifier">acceptor</span><span class="special">(</span><span class="identifier">ios</span><span class="special">,</span> <span class="identifier">endpoint</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">for</span> <span class="special">(;;)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">iostream</span> <span class="identifier">stream</span><span class="special">;</span>
|
||||
<span class="identifier">acceptor</span><span class="special">.</span><span class="identifier">accept</span><span class="special">(*</span><span class="identifier">stream</span><span class="special">.</span><span class="identifier">rdbuf</span><span class="special">());</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Timeouts may be set by calling <code class="computeroutput"><span class="identifier">expires_at</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">expires_from_now</span><span class="special">()</span></code> to establish a deadline. Any socket operations
|
||||
that occur past the deadline will put the iostream into a "bad"
|
||||
state.
|
||||
</p>
|
||||
<p>
|
||||
For example, a simple client program like this:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">iostream</span> <span class="identifier">stream</span><span class="special">;</span>
|
||||
<span class="identifier">stream</span><span class="special">.</span><span class="identifier">expires_from_now</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">60</span><span class="special">));</span>
|
||||
<span class="identifier">stream</span><span class="special">.</span><span class="identifier">connect</span><span class="special">(</span><span class="string">"www.boost.org"</span><span class="special">,</span> <span class="string">"http"</span><span class="special">);</span>
|
||||
<span class="identifier">stream</span> <span class="special"><<</span> <span class="string">"GET /LICENSE_1_0.txt HTTP/1.0\r\n"</span><span class="special">;</span>
|
||||
<span class="identifier">stream</span> <span class="special"><<</span> <span class="string">"Host: www.boost.org\r\n"</span><span class="special">;</span>
|
||||
<span class="identifier">stream</span> <span class="special"><<</span> <span class="string">"Accept: */*\r\n"</span><span class="special">;</span>
|
||||
<span class="identifier">stream</span> <span class="special"><<</span> <span class="string">"Connection: close\r\n\r\n"</span><span class="special">;</span>
|
||||
<span class="identifier">stream</span><span class="special">.</span><span class="identifier">flush</span><span class="special">();</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">stream</span><span class="special">.</span><span class="identifier">rdbuf</span><span class="special">();</span>
|
||||
</pre>
|
||||
<p>
|
||||
will fail if all the socket operations combined take longer than 60 seconds.
|
||||
</p>
|
||||
<p>
|
||||
If an error does occur, the iostream's <code class="computeroutput"><span class="identifier">error</span><span class="special">()</span></code> member function may be used to retrieve
|
||||
the error code from the most recent system call:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">if</span> <span class="special">(!</span><span class="identifier">stream</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Error: "</span> <span class="special"><<</span> <span class="identifier">stream</span><span class="special">.</span><span class="identifier">error</span><span class="special">().</span><span class="identifier">message</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"\n"</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.iostreams.h0"></a>
|
||||
<span><a name="asio.overview.networking.iostreams.see_also"></a></span><a class="link" href="iostreams.html#asio.overview.networking.iostreams.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__tcp/iostream.html" title="ip::tcp::iostream">ip::tcp::iostream</a>,
|
||||
<a class="link" href="../../reference/basic_socket_iostream.html" title="basic_socket_iostream">basic_socket_iostream</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.iostreams">iostreams examples</a>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.iostreams.h1"></a>
|
||||
<span><a name="asio.overview.networking.iostreams.notes"></a></span><a class="link" href="iostreams.html#asio.overview.networking.iostreams.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
These iostream templates only support <code class="computeroutput"><span class="keyword">char</span></code>,
|
||||
not <code class="computeroutput"><span class="keyword">wchar_t</span></code>, and do not perform
|
||||
any code conversion.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="other_protocols.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="bsd_sockets.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,150 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Support for Other Protocols</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../networking.html" title="Networking">
|
||||
<link rel="prev" href="protocols.html" title="TCP, UDP and ICMP">
|
||||
<link rel="next" href="iostreams.html" title="Socket Iostreams">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="protocols.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="iostreams.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.networking.other_protocols"></a><a class="link" href="other_protocols.html" title="Support for Other Protocols">Support for
|
||||
Other Protocols</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Support for other socket protocols (such as Bluetooth or IRCOMM sockets)
|
||||
can be added by implementing the <a class="link" href="../../reference/Protocol.html" title="Protocol requirements">protocol
|
||||
type requirements</a>. However, in many cases these protocols may also
|
||||
be used with Asio's generic protocol support. For this, Asio provides the
|
||||
following four classes:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a class="link" href="../../reference/generic__datagram_protocol.html" title="generic::datagram_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">datagram_protocol</span></code></a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../../reference/generic__raw_protocol.html" title="generic::raw_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">raw_protocol</span></code></a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../../reference/generic__seq_packet_protocol.html" title="generic::seq_packet_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">seq_packet_protocol</span></code></a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../../reference/generic__stream_protocol.html" title="generic::stream_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span></code></a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
These classes implement the <a class="link" href="../../reference/Protocol.html" title="Protocol requirements">protocol
|
||||
type requirements</a>, but allow the user to specify the address family
|
||||
(e.g. <code class="computeroutput"><span class="identifier">AF_INET</span></code>) and protocol
|
||||
type (e.g. <code class="computeroutput"><span class="identifier">IPPROTO_TCP</span></code>)
|
||||
at runtime. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">my_socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">open</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">(</span><span class="identifier">AF_INET</span><span class="special">,</span> <span class="identifier">IPPROTO_TCP</span><span class="special">));</span>
|
||||
<span class="special">...</span>
|
||||
</pre>
|
||||
<p>
|
||||
An endpoint class template, <a class="link" href="../../reference/generic__basic_endpoint.html" title="generic::basic_endpoint"><code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">basic_endpoint</span></code></a>, is included to
|
||||
support these protocol classes. This endpoint can hold any other endpoint
|
||||
type, provided its native representation fits into a <code class="computeroutput"><span class="identifier">sockaddr_storage</span></code>
|
||||
object. This class will also convert from other types that implement the
|
||||
<a class="link" href="../../reference/Endpoint.html" title="Endpoint requirements">endpoint</a> type requirements:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">my_endpoint1</span> <span class="special">=</span> <span class="special">...;</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">my_endpoint2</span><span class="special">(</span><span class="identifier">my_endpoint1</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
The conversion is implicit, so as to support the following use cases:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">my_socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">my_endpoint</span> <span class="special">=</span> <span class="special">...;</span>
|
||||
<span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">my_endpoint</span><span class="special">);</span>
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.other_protocols.h0"></a>
|
||||
<span><a name="asio.overview.networking.other_protocols.c__11_move_construction"></a></span><a class="link" href="other_protocols.html#asio.overview.networking.other_protocols.c__11_move_construction">C++11
|
||||
Move Construction</a>
|
||||
</h6>
|
||||
<p>
|
||||
When using C++11, it is possible to perform move construction from a socket
|
||||
(or acceptor) object to convert to the more generic protocol's socket (or
|
||||
acceptor) type. If the protocol conversion is valid:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">Protocol1</span> <span class="identifier">p1</span> <span class="special">=</span> <span class="special">...;</span>
|
||||
<span class="identifier">Protocol2</span> <span class="identifier">p2</span><span class="special">(</span><span class="identifier">p1</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
then the corresponding socket conversion is allowed:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">Protocol1</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">my_socket1</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">Protocol2</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">my_socket2</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">my_socket1</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
For example, one possible conversion is from a TCP socket to a generic
|
||||
stream-oriented socket:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">my_socket1</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">my_socket2</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">my_socket1</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
These conversions are also available for move-assignment.
|
||||
</p>
|
||||
<p>
|
||||
These conversions are not limited to the above generic protocol classes.
|
||||
User-defined protocols may take advantage of this feature by similarly
|
||||
ensuring the conversion from <code class="computeroutput"><span class="identifier">Protocol1</span></code>
|
||||
to <code class="computeroutput"><span class="identifier">Protocol2</span></code> is valid,
|
||||
as above.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.other_protocols.h1"></a>
|
||||
<span><a name="asio.overview.networking.other_protocols.accepting_generic_sockets"></a></span><a class="link" href="other_protocols.html#asio.overview.networking.other_protocols.accepting_generic_sockets">Accepting
|
||||
Generic Sockets</a>
|
||||
</h6>
|
||||
<p>
|
||||
As a convenience, a socket acceptor's <code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">async_accept</span><span class="special">()</span></code> functions can directly accept into a
|
||||
different protocol's socket type, provided the corresponding protocol conversion
|
||||
is valid. For example, the following is supported because the protocol
|
||||
<code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span></code> is convertible to <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">acceptor</span> <span class="identifier">my_acceptor</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">my_socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">my_acceptor</span><span class="special">.</span><span class="identifier">accept</span><span class="special">(</span><span class="identifier">my_socket</span><span class="special">);</span>
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.other_protocols.h2"></a>
|
||||
<span><a name="asio.overview.networking.other_protocols.see_also"></a></span><a class="link" href="other_protocols.html#asio.overview.networking.other_protocols.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/generic__datagram_protocol.html" title="generic::datagram_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">datagram_protocol</span></code></a>, <a class="link" href="../../reference/generic__raw_protocol.html" title="generic::raw_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">raw_protocol</span></code></a>, <a class="link" href="../../reference/generic__seq_packet_protocol.html" title="generic::seq_packet_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">seq_packet_protocol</span></code></a>, <a class="link" href="../../reference/generic__stream_protocol.html" title="generic::stream_protocol"><code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span></code></a>, <a class="link" href="../../reference/Protocol.html" title="Protocol requirements">protocol
|
||||
type requirements</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="protocols.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="iostreams.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,204 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>TCP, UDP and ICMP</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../networking.html" title="Networking">
|
||||
<link rel="prev" href="../networking.html" title="Networking">
|
||||
<link rel="next" href="other_protocols.html" title="Support for Other Protocols">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../networking.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="other_protocols.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.networking.protocols"></a><a class="link" href="protocols.html" title="TCP, UDP and ICMP">TCP, UDP and ICMP</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio provides off-the-shelf support for the internet protocols TCP, UDP
|
||||
and ICMP.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.protocols.h0"></a>
|
||||
<span><a name="asio.overview.networking.protocols.tcp_clients"></a></span><a class="link" href="protocols.html#asio.overview.networking.protocols.tcp_clients">TCP
|
||||
Clients</a>
|
||||
</h6>
|
||||
<p>
|
||||
Hostname resolution is performed using a resolver, where host and service
|
||||
names are looked up and converted into one or more endpoints:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span> <span class="identifier">resolver</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">query</span> <span class="identifier">query</span><span class="special">(</span><span class="string">"www.boost.org"</span><span class="special">,</span> <span class="string">"http"</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iter</span> <span class="special">=</span> <span class="identifier">resolver</span><span class="special">.</span><span class="identifier">resolve</span><span class="special">(</span><span class="identifier">query</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">end</span><span class="special">;</span> <span class="comment">// End marker.</span>
|
||||
<span class="keyword">while</span> <span class="special">(</span><span class="identifier">iter</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">endpoint</span> <span class="special">=</span> <span class="special">*</span><span class="identifier">iter</span><span class="special">++;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">endpoint</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
The list of endpoints obtained above could contain both IPv4 and IPv6 endpoints,
|
||||
so a program should try each of them until it finds one that works. This
|
||||
keeps the client program independent of a specific IP version.
|
||||
</p>
|
||||
<p>
|
||||
To simplify the development of protocol-independent programs, TCP clients
|
||||
may establish connections using the free functions <a class="link" href="../../reference/connect.html" title="connect">connect()</a>
|
||||
and <a class="link" href="../../reference/async_connect.html" title="async_connect">async_connect()</a>.
|
||||
These operations try each endpoint in a list until the socket is successfully
|
||||
connected. For example, a single call:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">socket</span><span class="special">,</span> <span class="identifier">resolver</span><span class="special">.</span><span class="identifier">resolve</span><span class="special">(</span><span class="identifier">query</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
will synchronously try all endpoints until one is successfully connected.
|
||||
Similarly, an asynchronous connect may be performed by writing:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_connect</span><span class="special">(</span><span class="identifier">socket_</span><span class="special">,</span> <span class="identifier">iter</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">client</span><span class="special">::</span><span class="identifier">handle_connect</span><span class="special">,</span> <span class="keyword">this</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// ...</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">handle_connect</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">error</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(!</span><span class="identifier">error</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// Start read or write operations.</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// Handle error.</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
When a specific endpoint is available, a socket can be created and connected:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">endpoint</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Data may be read from or written to a connected TCP socket using the <a class="link" href="../../reference/basic_stream_socket/receive.html" title="basic_stream_socket::receive">receive()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_receive.html" title="basic_stream_socket::async_receive">async_receive()</a>,
|
||||
<a class="link" href="../../reference/basic_stream_socket/send.html" title="basic_stream_socket::send">send()</a> or
|
||||
<a class="link" href="../../reference/basic_stream_socket/async_send.html" title="basic_stream_socket::async_send">async_send()</a>
|
||||
member functions. However, as these could result in <a class="link" href="../core/streams.html" title="Streams, Short Reads and Short Writes">short
|
||||
writes or reads</a>, an application will typically use the following
|
||||
operations instead: <a class="link" href="../../reference/read.html" title="read">read()</a>,
|
||||
<a class="link" href="../../reference/async_read.html" title="async_read">async_read()</a>, <a class="link" href="../../reference/write.html" title="write">write()</a>
|
||||
and <a class="link" href="../../reference/async_write.html" title="async_write">async_write()</a>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.protocols.h1"></a>
|
||||
<span><a name="asio.overview.networking.protocols.tcp_servers"></a></span><a class="link" href="protocols.html#asio.overview.networking.protocols.tcp_servers">TCP
|
||||
Servers</a>
|
||||
</h6>
|
||||
<p>
|
||||
A program uses an acceptor to accept incoming TCP connections:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">acceptor</span> <span class="identifier">acceptor</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">my_endpoint</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">acceptor</span><span class="special">.</span><span class="identifier">accept</span><span class="special">(</span><span class="identifier">socket</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
After a socket has been successfully accepted, it may be read from or written
|
||||
to as illustrated for TCP clients above.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.protocols.h2"></a>
|
||||
<span><a name="asio.overview.networking.protocols.udp"></a></span><a class="link" href="protocols.html#asio.overview.networking.protocols.udp">UDP</a>
|
||||
</h6>
|
||||
<p>
|
||||
UDP hostname resolution is also performed using a resolver:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span> <span class="identifier">resolver</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">query</span> <span class="identifier">query</span><span class="special">(</span><span class="string">"localhost"</span><span class="special">,</span> <span class="string">"daytime"</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iter</span> <span class="special">=</span> <span class="identifier">resolver</span><span class="special">.</span><span class="identifier">resolve</span><span class="special">(</span><span class="identifier">query</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
</pre>
|
||||
<p>
|
||||
A UDP socket is typically bound to a local endpoint. The following code
|
||||
will create an IP version 4 UDP socket and bind it to the "any"
|
||||
address on port <code class="computeroutput"><span class="number">12345</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">endpoint</span><span class="special">(</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">v4</span><span class="special">(),</span> <span class="number">12345</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">endpoint</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Data may be read from or written to an unconnected UDP socket using the
|
||||
<a class="link" href="../../reference/basic_datagram_socket/receive_from.html" title="basic_datagram_socket::receive_from">receive_from()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_receive_from.html" title="basic_datagram_socket::async_receive_from">async_receive_from()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/send_to.html" title="basic_datagram_socket::send_to">send_to()</a>
|
||||
or <a class="link" href="../../reference/basic_datagram_socket/async_send_to.html" title="basic_datagram_socket::async_send_to">async_send_to()</a>
|
||||
member functions. For a connected UDP socket, use the <a class="link" href="../../reference/basic_datagram_socket/receive.html" title="basic_datagram_socket::receive">receive()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/async_receive.html" title="basic_datagram_socket::async_receive">async_receive()</a>,
|
||||
<a class="link" href="../../reference/basic_datagram_socket/send.html" title="basic_datagram_socket::send">send()</a>
|
||||
or <a class="link" href="../../reference/basic_datagram_socket/async_send.html" title="basic_datagram_socket::async_send">async_send()</a>
|
||||
member functions.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.protocols.h3"></a>
|
||||
<span><a name="asio.overview.networking.protocols.icmp"></a></span><a class="link" href="protocols.html#asio.overview.networking.protocols.icmp">ICMP</a>
|
||||
</h6>
|
||||
<p>
|
||||
As with TCP and UDP, ICMP hostname resolution is performed using a resolver:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span><span class="special">::</span><span class="identifier">resolver</span> <span class="identifier">resolver</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">query</span> <span class="identifier">query</span><span class="special">(</span><span class="string">"localhost"</span><span class="special">,</span> <span class="string">""</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iter</span> <span class="special">=</span> <span class="identifier">resolver</span><span class="special">.</span><span class="identifier">resolve</span><span class="special">(</span><span class="identifier">query</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
</pre>
|
||||
<p>
|
||||
An ICMP socket may be bound to a local endpoint. The following code will
|
||||
create an IP version 6 ICMP socket and bind it to the "any" address:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">endpoint</span><span class="special">(</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span><span class="special">::</span><span class="identifier">v6</span><span class="special">(),</span> <span class="number">0</span><span class="special">);</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">endpoint</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
The port number is not used for ICMP.
|
||||
</p>
|
||||
<p>
|
||||
Data may be read from or written to an unconnected ICMP socket using the
|
||||
<a class="link" href="../../reference/basic_raw_socket/receive_from.html" title="basic_raw_socket::receive_from">receive_from()</a>,
|
||||
<a class="link" href="../../reference/basic_raw_socket/async_receive_from.html" title="basic_raw_socket::async_receive_from">async_receive_from()</a>,
|
||||
<a class="link" href="../../reference/basic_raw_socket/send_to.html" title="basic_raw_socket::send_to">send_to()</a>
|
||||
or <a class="link" href="../../reference/basic_raw_socket/async_send_to.html" title="basic_raw_socket::async_send_to">async_send_to()</a>
|
||||
member functions.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.networking.protocols.h4"></a>
|
||||
<span><a name="asio.overview.networking.protocols.see_also"></a></span><a class="link" href="protocols.html#asio.overview.networking.protocols.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/ip__tcp.html" title="ip::tcp">ip::tcp</a>, <a class="link" href="../../reference/ip__udp.html" title="ip::udp">ip::udp</a>,
|
||||
<a class="link" href="../../reference/ip__icmp.html" title="ip::icmp">ip::icmp</a>, <a class="link" href="../../tutorial/tutdaytime1.html" title="Daytime.1 - A synchronous TCP daytime client">daytime
|
||||
protocol tutorials</a>, <a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.icmp">ICMP
|
||||
ping example</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../networking.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../networking.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="other_protocols.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>POSIX-Specific Functionality</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="signals.html" title="Signal Handling">
|
||||
<link rel="next" href="posix/local.html" title="UNIX Domain Sockets">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="signals.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="posix/local.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.posix"></a><a class="link" href="posix.html" title="POSIX-Specific Functionality">POSIX-Specific Functionality</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="link" href="posix/local.html" title="UNIX Domain Sockets">UNIX Domain Sockets</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="posix/stream_descriptor.html" title="Stream-Oriented File Descriptors">Stream-Oriented File
|
||||
Descriptors</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="posix/fork.html" title="Fork">Fork</a>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="signals.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="posix/local.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,77 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Fork</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../posix.html" title="POSIX-Specific Functionality">
|
||||
<link rel="prev" href="stream_descriptor.html" title="Stream-Oriented File Descriptors">
|
||||
<link rel="next" href="../windows.html" title="Windows-Specific Functionality">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="stream_descriptor.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../windows.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.posix.fork"></a><a class="link" href="fork.html" title="Fork">Fork</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio supports programs that utilise the <code class="computeroutput"><span class="identifier">fork</span><span class="special">()</span></code> system call. Provided the program calls
|
||||
<code class="computeroutput"><span class="identifier">io_service</span><span class="special">.</span><span class="identifier">notify_fork</span><span class="special">()</span></code>
|
||||
at the appropriate times, Asio will recreate any internal file descriptors
|
||||
(such as the "self-pipe trick" descriptor used for waking up
|
||||
a reactor). The notification is usually performed as follows:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">io_service_</span><span class="special">.</span><span class="identifier">notify_fork</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">fork_prepare</span><span class="special">);</span>
|
||||
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">fork</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">io_service_</span><span class="special">.</span><span class="identifier">notify_fork</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">fork_child</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">io_service_</span><span class="special">.</span><span class="identifier">notify_fork</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">fork_parent</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
User-defined services can also be made fork-aware by overriding the <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">service</span><span class="special">::</span><span class="identifier">fork_service</span><span class="special">()</span></code>
|
||||
virtual function.
|
||||
</p>
|
||||
<p>
|
||||
Note that any file descriptors accessible via Asio's public API (e.g. the
|
||||
descriptors underlying <code class="computeroutput"><span class="identifier">basic_socket</span><span class="special"><></span></code>, <code class="computeroutput"><span class="identifier">posix</span><span class="special">::</span><span class="identifier">stream_descriptor</span></code>,
|
||||
etc.) are not altered during a fork. It is the program's responsibility
|
||||
to manage these as required.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.posix.fork.h0"></a>
|
||||
<span><a name="asio.overview.posix.fork.see_also"></a></span><a class="link" href="fork.html#asio.overview.posix.fork.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/io_service/notify_fork.html" title="io_service::notify_fork">io_service::notify_fork()</a>,
|
||||
<a class="link" href="../../reference/io_service/fork_event.html" title="io_service::fork_event">io_service::fork_event</a>,
|
||||
<a class="link" href="../../reference/io_service__service/fork_service.html" title="io_service::service::fork_service">io_service::service::fork_service()</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.fork">Fork examples</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="stream_descriptor.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../windows.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,104 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>UNIX Domain Sockets</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../posix.html" title="POSIX-Specific Functionality">
|
||||
<link rel="prev" href="../posix.html" title="POSIX-Specific Functionality">
|
||||
<link rel="next" href="stream_descriptor.html" title="Stream-Oriented File Descriptors">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../posix.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="stream_descriptor.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.posix.local"></a><a class="link" href="local.html" title="UNIX Domain Sockets">UNIX Domain Sockets</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio provides basic support UNIX domain sockets (also known as local sockets).
|
||||
The simplest use involves creating a pair of connected sockets. The following
|
||||
code:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">local</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket1</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket2</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">connect_pair</span><span class="special">(</span><span class="identifier">socket1</span><span class="special">,</span> <span class="identifier">socket2</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
will create a pair of stream-oriented sockets. To do the same for datagram-oriented
|
||||
sockets, use:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">local</span><span class="special">::</span><span class="identifier">datagram_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket1</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">datagram_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket2</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">connect_pair</span><span class="special">(</span><span class="identifier">socket1</span><span class="special">,</span> <span class="identifier">socket2</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
A UNIX domain socket server may be created by binding an acceptor to an
|
||||
endpoint, in much the same way as one does for a TCP server:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="special">::</span><span class="identifier">unlink</span><span class="special">(</span><span class="string">"/tmp/foobar"</span><span class="special">);</span> <span class="comment">// Remove previous binding.</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">ep</span><span class="special">(</span><span class="string">"/tmp/foobar"</span><span class="special">);</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">acceptor</span> <span class="identifier">acceptor</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">ep</span><span class="special">);</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">acceptor</span><span class="special">.</span><span class="identifier">accept</span><span class="special">(</span><span class="identifier">socket</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
A client that connects to this server might look like:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">local</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">ep</span><span class="special">(</span><span class="string">"/tmp/foobar"</span><span class="special">);</span>
|
||||
<span class="identifier">local</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">ep</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Transmission of file descriptors or credentials across UNIX domain sockets
|
||||
is not directly supported within Asio, but may be achieved by accessing
|
||||
the socket's underlying descriptor using the <a class="link" href="../../reference/basic_socket/native_handle.html" title="basic_socket::native_handle">native_handle()</a>
|
||||
member function.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.posix.local.h0"></a>
|
||||
<span><a name="asio.overview.posix.local.see_also"></a></span><a class="link" href="local.html#asio.overview.posix.local.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/local__connect_pair.html" title="local::connect_pair">local::connect_pair</a>,
|
||||
<a class="link" href="../../reference/local__datagram_protocol.html" title="local::datagram_protocol">local::datagram_protocol</a>,
|
||||
<a class="link" href="../../reference/local__datagram_protocol/endpoint.html" title="local::datagram_protocol::endpoint">local::datagram_protocol::endpoint</a>,
|
||||
<a class="link" href="../../reference/local__datagram_protocol/socket.html" title="local::datagram_protocol::socket">local::datagram_protocol::socket</a>,
|
||||
<a class="link" href="../../reference/local__stream_protocol.html" title="local::stream_protocol">local::stream_protocol</a>,
|
||||
<a class="link" href="../../reference/local__stream_protocol/acceptor.html" title="local::stream_protocol::acceptor">local::stream_protocol::acceptor</a>,
|
||||
<a class="link" href="../../reference/local__stream_protocol/endpoint.html" title="local::stream_protocol::endpoint">local::stream_protocol::endpoint</a>,
|
||||
<a class="link" href="../../reference/local__stream_protocol/iostream.html" title="local::stream_protocol::iostream">local::stream_protocol::iostream</a>,
|
||||
<a class="link" href="../../reference/local__stream_protocol/socket.html" title="local::stream_protocol::socket">local::stream_protocol::socket</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.unix_domain_sockets">UNIX domain
|
||||
sockets examples</a>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.posix.local.h1"></a>
|
||||
<span><a name="asio.overview.posix.local.notes"></a></span><a class="link" href="local.html#asio.overview.posix.local.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
UNIX domain sockets are only available at compile time if supported by
|
||||
the target operating system. A program may test for the macro <code class="computeroutput"><span class="identifier">ASIO_HAS_LOCAL_SOCKETS</span></code> to determine whether
|
||||
they are supported.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../posix.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="stream_descriptor.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,79 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Stream-Oriented File Descriptors</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../posix.html" title="POSIX-Specific Functionality">
|
||||
<link rel="prev" href="local.html" title="UNIX Domain Sockets">
|
||||
<link rel="next" href="fork.html" title="Fork">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="local.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="fork.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.posix.stream_descriptor"></a><a class="link" href="stream_descriptor.html" title="Stream-Oriented File Descriptors">Stream-Oriented
|
||||
File Descriptors</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio includes classes added to permit synchronous and asynchronous read
|
||||
and write operations to be performed on POSIX file descriptors, such as
|
||||
pipes, standard input and output, and various devices (but <span class="emphasis"><em>not</em></span>
|
||||
regular files).
|
||||
</p>
|
||||
<p>
|
||||
For example, to perform read and write operations on standard input and
|
||||
output, the following objects may be created:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">posix</span><span class="special">::</span><span class="identifier">stream_descriptor</span> <span class="identifier">in</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="special">::</span><span class="identifier">dup</span><span class="special">(</span><span class="identifier">STDIN_FILENO</span><span class="special">));</span>
|
||||
<span class="identifier">posix</span><span class="special">::</span><span class="identifier">stream_descriptor</span> <span class="identifier">out</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="special">::</span><span class="identifier">dup</span><span class="special">(</span><span class="identifier">STDOUT_FILENO</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
These are then used as synchronous or asynchronous read and write streams.
|
||||
This means the objects can be used with any of the <a class="link" href="../../reference/read.html" title="read">read()</a>,
|
||||
<a class="link" href="../../reference/async_read.html" title="async_read">async_read()</a>, <a class="link" href="../../reference/write.html" title="write">write()</a>,
|
||||
<a class="link" href="../../reference/async_write.html" title="async_write">async_write()</a>, <a class="link" href="../../reference/read_until.html" title="read_until">read_until()</a> or <a class="link" href="../../reference/async_read_until.html" title="async_read_until">async_read_until()</a>
|
||||
free functions.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.posix.stream_descriptor.h0"></a>
|
||||
<span><a name="asio.overview.posix.stream_descriptor.see_also"></a></span><a class="link" href="stream_descriptor.html#asio.overview.posix.stream_descriptor.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/posix__stream_descriptor.html" title="posix::stream_descriptor">posix::stream_descriptor</a>,
|
||||
<a class="link" href="../../reference/posix__basic_stream_descriptor.html" title="posix::basic_stream_descriptor">posix::basic_stream_descriptor</a>,
|
||||
<a class="link" href="../../reference/posix__stream_descriptor_service.html" title="posix::stream_descriptor_service">posix::stream_descriptor_service</a>,
|
||||
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.chat">Chat example (C++03)</a>,
|
||||
<a class="link" href="../../examples/cpp11_examples.html#asio.examples.cpp11_examples.chat">Chat example (C++11)</a>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.posix.stream_descriptor.h1"></a>
|
||||
<span><a name="asio.overview.posix.stream_descriptor.notes"></a></span><a class="link" href="stream_descriptor.html#asio.overview.posix.stream_descriptor.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
POSIX stream descriptors are only available at compile time if supported
|
||||
by the target operating system. A program may test for the macro <code class="computeroutput"><span class="identifier">ASIO_HAS_POSIX_STREAM_DESCRIPTOR</span></code> to determine
|
||||
whether they are supported.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="local.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="fork.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,97 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Rationale</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="../overview.html" title="Overview">
|
||||
<link rel="next" href="core.html" title="Core Concepts and Functionality">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../overview.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="core.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.rationale"></a><a class="link" href="rationale.html" title="Rationale">Rationale</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Most programs interact with the outside world in some way, whether it be
|
||||
via a file, a network, a serial cable, or the console. Sometimes, as is the
|
||||
case with networking, individual I/O operations can take a long time to complete.
|
||||
This poses particular challenges to application development.
|
||||
</p>
|
||||
<p>
|
||||
Asio provides the tools to manage these long running operations, without
|
||||
requiring programs to use concurrency models based on threads and explicit
|
||||
locking.
|
||||
</p>
|
||||
<p>
|
||||
The Asio library is intended for programmers using C++ for systems programming,
|
||||
where access to operating system functionality such as networking is often
|
||||
required. In particular, Asio addresses the following goals:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Portability.</strong></span> The library should support
|
||||
a range of commonly used operating systems, and provide consistent behaviour
|
||||
across these operating systems.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Scalability.</strong></span> The library should facilitate
|
||||
the development of network applications that scale to thousands of concurrent
|
||||
connections. The library implementation for each operating system should
|
||||
use the mechanism that best enables this scalability.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Efficiency.</strong></span> The library should support
|
||||
techniques such as scatter-gather I/O, and allow programs to minimise
|
||||
data copying.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Model concepts from established APIs, such as BSD
|
||||
sockets.</strong></span> The BSD socket API is widely implemented and understood,
|
||||
and is covered in much literature. Other programming languages often
|
||||
use a similar interface for networking APIs. As far as is reasonable,
|
||||
Asio should leverage existing practice.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Ease of use.</strong></span> The library should provide
|
||||
a lower entry barrier for new users by taking a toolkit, rather than
|
||||
framework, approach. That is, it should try to minimise the up-front
|
||||
investment in time to just learning a few basic rules and guidelines.
|
||||
After that, a library user should only need to understand the specific
|
||||
functions that are being used.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Basis for further abstraction.</strong></span> The library
|
||||
should permit the development of other libraries that provide higher
|
||||
levels of abstraction. For example, implementations of commonly used
|
||||
protocols such as HTTP.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Although Asio started life focused primarily on networking, its concepts
|
||||
of asynchronous I/O have been extended to include other operating system
|
||||
resources such as serial ports, file descriptors, and so on.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../overview.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="core.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,86 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Serial Ports</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="timers.html" title="Timers">
|
||||
<link rel="next" href="signals.html" title="Signal Handling">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="timers.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="signals.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.serial_ports"></a><a class="link" href="serial_ports.html" title="Serial Ports">Serial Ports</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Asio includes classes for creating and manipulating serial ports in a portable
|
||||
manner. For example, a serial port may be opened using:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">serial_port</span> <span class="identifier">port</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">name</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
where name is something like <code class="computeroutput"><span class="string">"COM1"</span></code>
|
||||
on Windows, and <code class="computeroutput"><span class="string">"/dev/ttyS0"</span></code>
|
||||
on POSIX platforms.
|
||||
</p>
|
||||
<p>
|
||||
Once opened, the serial port may be used as a <a class="link" href="core/streams.html" title="Streams, Short Reads and Short Writes">stream</a>.
|
||||
This means the objects can be used with any of the <a class="link" href="../reference/read.html" title="read">read()</a>,
|
||||
<a class="link" href="../reference/async_read.html" title="async_read">async_read()</a>, <a class="link" href="../reference/write.html" title="write">write()</a>,
|
||||
<a class="link" href="../reference/async_write.html" title="async_write">async_write()</a>, <a class="link" href="../reference/read_until.html" title="read_until">read_until()</a>
|
||||
or <a class="link" href="../reference/async_read_until.html" title="async_read_until">async_read_until()</a>
|
||||
free functions.
|
||||
</p>
|
||||
<p>
|
||||
The serial port implementation also includes option classes for configuring
|
||||
the port's baud rate, flow control type, parity, stop bits and character
|
||||
size.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.overview.serial_ports.h0"></a>
|
||||
<span><a name="asio.overview.serial_ports.see_also"></a></span><a class="link" href="serial_ports.html#asio.overview.serial_ports.see_also">See
|
||||
Also</a>
|
||||
</h5>
|
||||
<p>
|
||||
<a class="link" href="../reference/serial_port.html" title="serial_port">serial_port</a>, <a class="link" href="../reference/serial_port_base.html" title="serial_port_base">serial_port_base</a>,
|
||||
<a class="link" href="../reference/basic_serial_port.html" title="basic_serial_port">basic_serial_port</a>,
|
||||
<a class="link" href="../reference/serial_port_service.html" title="serial_port_service">serial_port_service</a>,
|
||||
<a class="link" href="../reference/serial_port_base__baud_rate.html" title="serial_port_base::baud_rate">serial_port_base::baud_rate</a>,
|
||||
<a class="link" href="../reference/serial_port_base__flow_control.html" title="serial_port_base::flow_control">serial_port_base::flow_control</a>,
|
||||
<a class="link" href="../reference/serial_port_base__parity.html" title="serial_port_base::parity">serial_port_base::parity</a>,
|
||||
<a class="link" href="../reference/serial_port_base__stop_bits.html" title="serial_port_base::stop_bits">serial_port_base::stop_bits</a>,
|
||||
<a class="link" href="../reference/serial_port_base__character_size.html" title="serial_port_base::character_size">serial_port_base::character_size</a>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.overview.serial_ports.h1"></a>
|
||||
<span><a name="asio.overview.serial_ports.notes"></a></span><a class="link" href="serial_ports.html#asio.overview.serial_ports.notes">Notes</a>
|
||||
</h5>
|
||||
<p>
|
||||
Serial ports are available on all POSIX platforms. For Windows, serial ports
|
||||
are only available at compile time when the I/O completion port backend is
|
||||
used (which is the default). A program may test for the macro <code class="computeroutput"><span class="identifier">ASIO_HAS_SERIAL_PORT</span></code> to determine whether
|
||||
they are supported.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="timers.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="signals.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,76 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Signal Handling</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="serial_ports.html" title="Serial Ports">
|
||||
<link rel="next" href="posix.html" title="POSIX-Specific Functionality">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="serial_ports.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="posix.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.signals"></a><a class="link" href="signals.html" title="Signal Handling">Signal Handling</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Asio supports signal handling using a class called <a class="link" href="../reference/signal_set.html" title="signal_set">signal_set</a>.
|
||||
Programs may add one or more signals to the set, and then perform an <code class="computeroutput"><span class="identifier">async_wait</span><span class="special">()</span></code>
|
||||
operation. The specified handler will be called when one of the signals occurs.
|
||||
The same signal number may be registered with multiple <a class="link" href="../reference/signal_set.html" title="signal_set">signal_set</a>
|
||||
objects, however the signal number must be used only with Asio.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">error</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">signal_number</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(!</span><span class="identifier">error</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// A signal occurred.</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="special">...</span>
|
||||
|
||||
<span class="comment">// Construct a signal set registered for process termination.</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">signal_set</span> <span class="identifier">signals</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">,</span> <span class="identifier">SIGINT</span><span class="special">,</span> <span class="identifier">SIGTERM</span><span class="special">);</span>
|
||||
|
||||
<span class="comment">// Start an asynchronous wait for one of the signals to occur.</span>
|
||||
<span class="identifier">signals</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">handler</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Signal handling also works on Windows, as the Microsoft Visual C++ runtime
|
||||
library maps console events like Ctrl+C to the equivalent signal.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.overview.signals.h0"></a>
|
||||
<span><a name="asio.overview.signals.see_also"></a></span><a class="link" href="signals.html#asio.overview.signals.see_also">See
|
||||
Also</a>
|
||||
</h5>
|
||||
<p>
|
||||
<a class="link" href="../reference/signal_set.html" title="signal_set">signal_set</a>, <a class="link" href="../examples/cpp03_examples.html#asio.examples.cpp03_examples.http_server">HTTP
|
||||
server example (C++03)</a>, <a class="link" href="../examples/cpp11_examples.html#asio.examples.cpp11_examples.http_server">HTTP
|
||||
server example (C++11)</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="serial_ports.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="posix.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,187 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>SSL</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="windows/object_handle.html" title="Object HANDLEs">
|
||||
<link rel="next" href="cpp2011.html" title="C++ 2011 Support">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="windows/object_handle.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp2011.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.ssl"></a><a class="link" href="ssl.html" title="SSL">SSL</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Asio contains classes and class templates for basic SSL support. These classes
|
||||
allow encrypted communication to be layered on top of an existing stream,
|
||||
such as a TCP socket.
|
||||
</p>
|
||||
<p>
|
||||
Before creating an encrypted stream, an application must construct an SSL
|
||||
context object. This object is used to set SSL options such as verification
|
||||
mode, certificate files, and so on. As an illustration, client-side initialisation
|
||||
may look something like:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span> <span class="identifier">ctx</span><span class="special">(</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span><span class="special">::</span><span class="identifier">sslv23</span><span class="special">);</span>
|
||||
<span class="identifier">ctx</span><span class="special">.</span><span class="identifier">set_verify_mode</span><span class="special">(</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">verify_peer</span><span class="special">);</span>
|
||||
<span class="identifier">ctx</span><span class="special">.</span><span class="identifier">load_verify_file</span><span class="special">(</span><span class="string">"ca.pem"</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
To use SSL with a TCP socket, one may write:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special"><</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">></span> <span class="identifier">ssl_sock</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">ctx</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
To perform socket-specific operations, such as establishing an outbound connection
|
||||
or accepting an incoming one, the underlying socket must first be obtained
|
||||
using the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span></code> template's <a class="link" href="../reference/ssl__stream/lowest_layer.html" title="ssl::stream::lowest_layer"><code class="computeroutput"><span class="identifier">lowest_layer</span><span class="special">()</span></code></a>
|
||||
member function:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">::</span><span class="identifier">lowest_layer_type</span><span class="special">&</span> <span class="identifier">sock</span> <span class="special">=</span> <span class="identifier">ssl_sock</span><span class="special">.</span><span class="identifier">lowest_layer</span><span class="special">();</span>
|
||||
<span class="identifier">sock</span><span class="special">.</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">my_endpoint</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
In some use cases the underlying stream object will need to have a longer
|
||||
lifetime than the SSL stream, in which case the template parameter should
|
||||
be a reference to the stream type:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">sock</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">);</span>
|
||||
<span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special"><</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&></span> <span class="identifier">ssl_sock</span><span class="special">(</span><span class="identifier">sock</span><span class="special">,</span> <span class="identifier">ctx</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
SSL handshaking must be performed prior to transmitting or receiving data
|
||||
over an encrypted connection. This is accomplished using the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span></code>
|
||||
template's <a class="link" href="../reference/ssl__stream/handshake.html" title="ssl::stream::handshake">handshake()</a>
|
||||
or <a class="link" href="../reference/ssl__stream/async_handshake.html" title="ssl::stream::async_handshake">async_handshake()</a>
|
||||
member functions.
|
||||
</p>
|
||||
<p>
|
||||
Once connected, SSL stream objects are used as synchronous or asynchronous
|
||||
read and write streams. This means the objects can be used with any of the
|
||||
<a class="link" href="../reference/read.html" title="read">read()</a>, <a class="link" href="../reference/async_read.html" title="async_read">async_read()</a>,
|
||||
<a class="link" href="../reference/write.html" title="write">write()</a>, <a class="link" href="../reference/async_write.html" title="async_write">async_write()</a>,
|
||||
<a class="link" href="../reference/read_until.html" title="read_until">read_until()</a> or <a class="link" href="../reference/async_read_until.html" title="async_read_until">async_read_until()</a>
|
||||
free functions.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.overview.ssl.h0"></a>
|
||||
<span><a name="asio.overview.ssl.certificate_verification"></a></span><a class="link" href="ssl.html#asio.overview.ssl.certificate_verification">Certificate
|
||||
Verification</a>
|
||||
</h5>
|
||||
<p>
|
||||
Asio provides various methods for configuring the way SSL certificates are
|
||||
verified:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a class="link" href="../reference/ssl__context/set_default_verify_paths.html" title="ssl::context::set_default_verify_paths">ssl::context::set_default_verify_paths()</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../reference/ssl__context/set_verify_mode.html" title="ssl::context::set_verify_mode">ssl::context::set_verify_mode()</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../reference/ssl__context/set_verify_callback.html" title="ssl::context::set_verify_callback">ssl::context::set_verify_callback()</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../reference/ssl__context/load_verify_file.html" title="ssl::context::load_verify_file">ssl::context::load_verify_file()</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../reference/ssl__stream/set_verify_mode.html" title="ssl::stream::set_verify_mode">ssl::stream::set_verify_mode()</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="../reference/ssl__stream/set_verify_callback.html" title="ssl::stream::set_verify_callback">ssl::stream::set_verify_callback()</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
To simplify use cases where certificates are verified according to the rules
|
||||
in RFC 2818 (certificate verification for HTTPS), Asio provides a reusable
|
||||
verification callback as a function object:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
<a class="link" href="../reference/ssl__rfc2818_verification.html" title="ssl::rfc2818_verification">ssl::rfc2818_verification</a>
|
||||
</li></ul></div>
|
||||
<p>
|
||||
The following example shows verification of a remote host's certificate according
|
||||
to the rules used by HTTPS:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">;</span>
|
||||
<span class="keyword">namespace</span> <span class="identifier">ssl</span> <span class="special">=</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">ssl</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special"><</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">></span> <span class="identifier">ssl_socket</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// Create a context that uses the default paths for</span>
|
||||
<span class="comment">// finding CA certificates.</span>
|
||||
<span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span> <span class="identifier">ctx</span><span class="special">(</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span><span class="special">::</span><span class="identifier">sslv23</span><span class="special">);</span>
|
||||
<span class="identifier">ctx</span><span class="special">.</span><span class="identifier">set_default_verify_paths</span><span class="special">();</span>
|
||||
|
||||
<span class="comment">// Open a socket and connect it to the remote host.</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span> <span class="identifier">io_service</span><span class="special">;</span>
|
||||
<span class="identifier">ssl_socket</span> <span class="identifier">sock</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">,</span> <span class="identifier">ctx</span><span class="special">);</span>
|
||||
<span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span> <span class="identifier">resolver</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">);</span>
|
||||
<span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">query</span> <span class="identifier">query</span><span class="special">(</span><span class="string">"host.name"</span><span class="special">,</span> <span class="string">"https"</span><span class="special">);</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">connect</span><span class="special">(</span><span class="identifier">sock</span><span class="special">.</span><span class="identifier">lowest_layer</span><span class="special">(),</span> <span class="identifier">resolver</span><span class="special">.</span><span class="identifier">resolve</span><span class="special">(</span><span class="identifier">query</span><span class="special">));</span>
|
||||
<span class="identifier">sock</span><span class="special">.</span><span class="identifier">lowest_layer</span><span class="special">().</span><span class="identifier">set_option</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">no_delay</span><span class="special">(</span><span class="keyword">true</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// Perform SSL handshake and verify the remote host's</span>
|
||||
<span class="comment">// certificate.</span>
|
||||
<span class="identifier">sock</span><span class="special">.</span><span class="identifier">set_verify_mode</span><span class="special">(</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">verify_peer</span><span class="special">);</span>
|
||||
<span class="identifier">sock</span><span class="special">.</span><span class="identifier">set_verify_callback</span><span class="special">(</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">rfc2818_verification</span><span class="special">(</span><span class="string">"host.name"</span><span class="special">));</span>
|
||||
<span class="identifier">sock</span><span class="special">.</span><span class="identifier">handshake</span><span class="special">(</span><span class="identifier">ssl_socket</span><span class="special">::</span><span class="identifier">client</span><span class="special">);</span>
|
||||
|
||||
<span class="comment">// ... read and write as normal ...</span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.overview.ssl.h1"></a>
|
||||
<span><a name="asio.overview.ssl.ssl_and_threads"></a></span><a class="link" href="ssl.html#asio.overview.ssl.ssl_and_threads">SSL
|
||||
and Threads</a>
|
||||
</h5>
|
||||
<p>
|
||||
SSL stream objects perform no locking of their own. Therefore, it is essential
|
||||
that all asynchronous SSL operations are performed in an implicit or explicit
|
||||
<a class="link" href="core/strands.html" title="Strands: Use Threads Without Explicit Locking">strand</a>. Note that this
|
||||
means that no synchronisation is required (and so no locking overhead is
|
||||
incurred) in single threaded programs.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.overview.ssl.h2"></a>
|
||||
<span><a name="asio.overview.ssl.see_also"></a></span><a class="link" href="ssl.html#asio.overview.ssl.see_also">See
|
||||
Also</a>
|
||||
</h5>
|
||||
<p>
|
||||
<a class="link" href="../reference/ssl__context.html" title="ssl::context">ssl::context</a>, <a class="link" href="../reference/ssl__rfc2818_verification.html" title="ssl::rfc2818_verification">ssl::rfc2818_verification</a>,
|
||||
<a class="link" href="../reference/ssl__stream.html" title="ssl::stream">ssl::stream</a>, <a class="link" href="../examples/cpp03_examples.html#asio.examples.cpp03_examples.ssl">SSL
|
||||
example</a>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.overview.ssl.h3"></a>
|
||||
<span><a name="asio.overview.ssl.notes"></a></span><a class="link" href="ssl.html#asio.overview.ssl.notes">Notes</a>
|
||||
</h5>
|
||||
<p>
|
||||
<a href="http://www.openssl.org" target="_top">OpenSSL</a> is required to make use
|
||||
of Asio's SSL support. When an application needs to use OpenSSL functionality
|
||||
that is not wrapped by Asio, the underlying OpenSSL types may be obtained
|
||||
by calling <a class="link" href="../reference/ssl__context/native_handle.html" title="ssl::context::native_handle"><code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span><span class="special">::</span><span class="identifier">native_handle</span><span class="special">()</span></code></a> or <a class="link" href="../reference/ssl__stream/native_handle.html" title="ssl::stream::native_handle"><code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">::</span><span class="identifier">native_handle</span><span class="special">()</span></code></a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="windows/object_handle.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp2011.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,88 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Timers</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="networking/bsd_sockets.html" title="The BSD Socket API and Asio">
|
||||
<link rel="next" href="serial_ports.html" title="Serial Ports">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="networking/bsd_sockets.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="serial_ports.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.timers"></a><a class="link" href="timers.html" title="Timers">Timers</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Long running I/O operations will often have a deadline by which they must
|
||||
have completed. These deadlines may be expressed as absolute times, but are
|
||||
often calculated relative to the current time.
|
||||
</p>
|
||||
<p>
|
||||
As a simple example, to perform a synchronous wait operation on a timer using
|
||||
a relative time one may write:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">io_service</span> <span class="identifier">i</span><span class="special">;</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">deadline_timer</span> <span class="identifier">t</span><span class="special">(</span><span class="identifier">i</span><span class="special">);</span>
|
||||
<span class="identifier">t</span><span class="special">.</span><span class="identifier">expires_from_now</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">t</span><span class="special">.</span><span class="identifier">wait</span><span class="special">();</span>
|
||||
</pre>
|
||||
<p>
|
||||
More commonly, a program will perform an asynchronous wait operation on a
|
||||
timer:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">io_service</span> <span class="identifier">i</span><span class="special">;</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">deadline_timer</span> <span class="identifier">t</span><span class="special">(</span><span class="identifier">i</span><span class="special">);</span>
|
||||
<span class="identifier">t</span><span class="special">.</span><span class="identifier">expires_from_now</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">milliseconds</span><span class="special">(</span><span class="number">400</span><span class="special">));</span>
|
||||
<span class="identifier">t</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">handler</span><span class="special">);</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">i</span><span class="special">.</span><span class="identifier">run</span><span class="special">();</span>
|
||||
</pre>
|
||||
<p>
|
||||
The deadline associated with a timer may also be obtained as a relative time:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">time_duration</span> <span class="identifier">time_until_expiry</span>
|
||||
<span class="special">=</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">expires_from_now</span><span class="special">();</span>
|
||||
</pre>
|
||||
<p>
|
||||
or as an absolute time to allow composition of timers:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">deadline_timer</span> <span class="identifier">t2</span><span class="special">(</span><span class="identifier">i</span><span class="special">);</span>
|
||||
<span class="identifier">t2</span><span class="special">.</span><span class="identifier">expires_at</span><span class="special">(</span><span class="identifier">t</span><span class="special">.</span><span class="identifier">expires_at</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">30</span><span class="special">));</span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.overview.timers.h0"></a>
|
||||
<span><a name="asio.overview.timers.see_also"></a></span><a class="link" href="timers.html#asio.overview.timers.see_also">See
|
||||
Also</a>
|
||||
</h5>
|
||||
<p>
|
||||
<a class="link" href="../reference/basic_deadline_timer.html" title="basic_deadline_timer">basic_deadline_timer</a>,
|
||||
<a class="link" href="../reference/deadline_timer.html" title="deadline_timer">deadline_timer</a>, <a class="link" href="../reference/deadline_timer_service.html" title="deadline_timer_service">deadline_timer_service</a>,
|
||||
<a class="link" href="../tutorial/tuttimer1.html" title="Timer.1 - Using a timer synchronously">timer tutorials</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="networking/bsd_sockets.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="serial_ports.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Windows-Specific Functionality</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../overview.html" title="Overview">
|
||||
<link rel="prev" href="posix/fork.html" title="Fork">
|
||||
<link rel="next" href="windows/stream_handle.html" title="Stream-Oriented HANDLEs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="posix/fork.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="windows/stream_handle.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.overview.windows"></a><a class="link" href="windows.html" title="Windows-Specific Functionality">Windows-Specific Functionality</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="link" href="windows/stream_handle.html" title="Stream-Oriented HANDLEs">Stream-Oriented HANDLEs</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="windows/random_access_handle.html" title="Random-Access HANDLEs">Random-Access
|
||||
HANDLEs</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="windows/object_handle.html" title="Object HANDLEs">Object HANDLEs</a>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="posix/fork.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="windows/stream_handle.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,99 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Object HANDLEs</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../windows.html" title="Windows-Specific Functionality">
|
||||
<link rel="prev" href="random_access_handle.html" title="Random-Access HANDLEs">
|
||||
<link rel="next" href="../ssl.html" title="SSL">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="random_access_handle.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../ssl.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.windows.object_handle"></a><a class="link" href="object_handle.html" title="Object HANDLEs">Object HANDLEs</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio provides Windows-specific classes that permit asynchronous wait operations
|
||||
to be performed on HANDLEs to kernel objects of the following types:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Change notification
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Console input
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Event
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Memory resource notification
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Process
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Semaphore
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Thread
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Waitable timer
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
For example, to perform asynchronous operations on an event, the following
|
||||
object may be created:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">HANDLE</span> <span class="identifier">handle</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">CreateEvent</span><span class="special">(...);</span>
|
||||
<span class="identifier">windows</span><span class="special">::</span><span class="identifier">object_handle</span> <span class="identifier">file</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">handle</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">wait</span><span class="special">()</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">async_wait</span><span class="special">()</span></code>
|
||||
member functions may then be used to wait until the kernel object is signalled.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.windows.object_handle.h0"></a>
|
||||
<span><a name="asio.overview.windows.object_handle.see_also"></a></span><a class="link" href="object_handle.html#asio.overview.windows.object_handle.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/windows__object_handle.html" title="windows::object_handle">windows::object_handle</a>,
|
||||
<a class="link" href="../../reference/windows__basic_object_handle.html" title="windows::basic_object_handle">windows::basic_object_handle</a>,
|
||||
<a class="link" href="../../reference/windows__object_handle_service.html" title="windows::object_handle_service">windows::object_handle_service</a>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.windows.object_handle.h1"></a>
|
||||
<span><a name="asio.overview.windows.object_handle.notes"></a></span><a class="link" href="object_handle.html#asio.overview.windows.object_handle.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
Windows object <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
|
||||
are only available at compile time when targeting Windows. Programs may
|
||||
test for the macro <code class="computeroutput"><span class="identifier">ASIO_HAS_WINDOWS_OBJECT_HANDLE</span></code>
|
||||
to determine whether they are supported.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="random_access_handle.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="../ssl.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,81 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Random-Access HANDLEs</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../windows.html" title="Windows-Specific Functionality">
|
||||
<link rel="prev" href="stream_handle.html" title="Stream-Oriented HANDLEs">
|
||||
<link rel="next" href="object_handle.html" title="Object HANDLEs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="stream_handle.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="object_handle.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.windows.random_access_handle"></a><a class="link" href="random_access_handle.html" title="Random-Access HANDLEs">Random-Access
|
||||
HANDLEs</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio provides Windows-specific classes that permit asynchronous read and
|
||||
write operations to be performed on HANDLEs that refer to regular files.
|
||||
</p>
|
||||
<p>
|
||||
For example, to perform asynchronous operations on a file the following
|
||||
object may be created:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">HANDLE</span> <span class="identifier">handle</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">CreateFile</span><span class="special">(...);</span>
|
||||
<span class="identifier">windows</span><span class="special">::</span><span class="identifier">random_access_handle</span> <span class="identifier">file</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">handle</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Data may be read from or written to the handle using one of the <code class="computeroutput"><span class="identifier">read_some_at</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">async_read_some_at</span><span class="special">()</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">write_some_at</span><span class="special">()</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">async_write_some_at</span><span class="special">()</span></code> member functions. However, like the equivalent
|
||||
functions (<code class="computeroutput"><span class="identifier">read_some</span><span class="special">()</span></code>,
|
||||
etc.) on streams, these functions are only required to transfer one or
|
||||
more bytes in a single operation. Therefore free functions called <a class="link" href="../../reference/read_at.html" title="read_at">read_at()</a>, <a class="link" href="../../reference/async_read_at.html" title="async_read_at">async_read_at()</a>,
|
||||
<a class="link" href="../../reference/write_at.html" title="write_at">write_at()</a> and <a class="link" href="../../reference/async_write_at.html" title="async_write_at">async_write_at()</a>
|
||||
have been created to repeatedly call the corresponding <code class="literal"><span class="bold"><strong>*</strong></span>_some_at()</code> function until all data has
|
||||
been transferred.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.windows.random_access_handle.h0"></a>
|
||||
<span><a name="asio.overview.windows.random_access_handle.see_also"></a></span><a class="link" href="random_access_handle.html#asio.overview.windows.random_access_handle.see_also">See Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/windows__random_access_handle.html" title="windows::random_access_handle">windows::random_access_handle</a>,
|
||||
<a class="link" href="../../reference/windows__basic_random_access_handle.html" title="windows::basic_random_access_handle">windows::basic_random_access_handle</a>,
|
||||
<a class="link" href="../../reference/windows__random_access_handle_service.html" title="windows::random_access_handle_service">windows::random_access_handle_service</a>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.windows.random_access_handle.h1"></a>
|
||||
<span><a name="asio.overview.windows.random_access_handle.notes"></a></span><a class="link" href="random_access_handle.html#asio.overview.windows.random_access_handle.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
Windows random-access <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
|
||||
are only available at compile time when targeting Windows and only when
|
||||
the I/O completion port backend is used (which is the default). A program
|
||||
may test for the macro <code class="computeroutput"><span class="identifier">ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE</span></code>
|
||||
to determine whether they are supported.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="stream_handle.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="object_handle.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,83 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Stream-Oriented HANDLEs</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../windows.html" title="Windows-Specific Functionality">
|
||||
<link rel="prev" href="../windows.html" title="Windows-Specific Functionality">
|
||||
<link rel="next" href="random_access_handle.html" title="Random-Access HANDLEs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../windows.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="random_access_handle.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.overview.windows.stream_handle"></a><a class="link" href="stream_handle.html" title="Stream-Oriented HANDLEs">Stream-Oriented
|
||||
HANDLEs</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asio contains classes to allow asynchronous read and write operations to
|
||||
be performed on Windows <code class="computeroutput"><span class="identifier">HANDLE</span></code>s,
|
||||
such as named pipes.
|
||||
</p>
|
||||
<p>
|
||||
For example, to perform asynchronous operations on a named pipe, the following
|
||||
object may be created:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">HANDLE</span> <span class="identifier">handle</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">CreateFile</span><span class="special">(...);</span>
|
||||
<span class="identifier">windows</span><span class="special">::</span><span class="identifier">stream_handle</span> <span class="identifier">pipe</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">handle</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
These are then used as synchronous or asynchronous read and write streams.
|
||||
This means the objects can be used with any of the <a class="link" href="../../reference/read.html" title="read">read()</a>,
|
||||
<a class="link" href="../../reference/async_read.html" title="async_read">async_read()</a>, <a class="link" href="../../reference/write.html" title="write">write()</a>,
|
||||
<a class="link" href="../../reference/async_write.html" title="async_write">async_write()</a>, <a class="link" href="../../reference/read_until.html" title="read_until">read_until()</a> or <a class="link" href="../../reference/async_read_until.html" title="async_read_until">async_read_until()</a>
|
||||
free functions.
|
||||
</p>
|
||||
<p>
|
||||
The kernel object referred to by the <code class="computeroutput"><span class="identifier">HANDLE</span></code>
|
||||
must support use with I/O completion ports (which means that named pipes
|
||||
are supported, but anonymous pipes and console streams are not).
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.windows.stream_handle.h0"></a>
|
||||
<span><a name="asio.overview.windows.stream_handle.see_also"></a></span><a class="link" href="stream_handle.html#asio.overview.windows.stream_handle.see_also">See
|
||||
Also</a>
|
||||
</h6>
|
||||
<p>
|
||||
<a class="link" href="../../reference/windows__stream_handle.html" title="windows::stream_handle">windows::stream_handle</a>,
|
||||
<a class="link" href="../../reference/windows__basic_stream_handle.html" title="windows::basic_stream_handle">windows::basic_stream_handle</a>,
|
||||
<a class="link" href="../../reference/windows__stream_handle_service.html" title="windows::stream_handle_service">windows::stream_handle_service</a>.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.overview.windows.stream_handle.h1"></a>
|
||||
<span><a name="asio.overview.windows.stream_handle.notes"></a></span><a class="link" href="stream_handle.html#asio.overview.windows.stream_handle.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
Windows stream <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
|
||||
are only available at compile time when targeting Windows and only when
|
||||
the I/O completion port backend is used (which is the default). A program
|
||||
may test for the macro <code class="computeroutput"><span class="identifier">ASIO_HAS_WINDOWS_STREAM_HANDLE</span></code>
|
||||
to determine whether they are supported.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../windows.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="random_access_handle.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,524 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../index.html" title="Asio">
|
||||
<link rel="up" href="../index.html" title="Asio">
|
||||
<link rel="prev" href="examples/cpp11_examples.html" title="C++11 Examples">
|
||||
<link rel="next" href="reference/asynchronous_operations.html" title="Requirements on asynchronous operations">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="examples/cpp11_examples.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="reference/asynchronous_operations.html"><img src="../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="asio.reference"></a><a class="link" href="reference.html" title="Reference">Reference</a>
|
||||
</h2></div></div></div>
|
||||
<div class="informaltable">
|
||||
<table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr><th colspan="4" valign="center">
|
||||
<h3>
|
||||
<a name="idp90740496"></a>Core</h3>
|
||||
</th></tr></thead>
|
||||
<tbody><tr>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90742576"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/const_buffer.html" title="const_buffer">const_buffer</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/const_buffers_1.html" title="const_buffers_1">const_buffers_1</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/coroutine.html" title="coroutine">coroutine</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/error_code.html" title="error_code">error_code</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/invalid_service_owner.html" title="invalid_service_owner">invalid_service_owner</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/io_service.html" title="io_service">io_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/io_service__id.html" title="io_service::id">io_service::id</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/io_service__service.html" title="io_service::service">io_service::service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/io_service__strand.html" title="io_service::strand">io_service::strand</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/io_service__work.html" title="io_service::work">io_service::work</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/mutable_buffer.html" title="mutable_buffer">mutable_buffer</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/mutable_buffers_1.html" title="mutable_buffers_1">mutable_buffers_1</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/null_buffers.html" title="null_buffers">null_buffers</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/service_already_exists.html" title="service_already_exists">service_already_exists</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/streambuf.html" title="streambuf">streambuf</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/system_error.html" title="system_error">system_error</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/thread.html" title="thread">thread</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/use_future_t.html" title="use_future_t">use_future_t</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/yield_context.html" title="yield_context">yield_context</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp90763264"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/basic_io_object.html" title="basic_io_object">basic_io_object</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_streambuf.html" title="basic_streambuf">basic_streambuf</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_yield_context.html" title="basic_yield_context">basic_yield_context</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffered_read_stream.html" title="buffered_read_stream">buffered_read_stream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffered_stream.html" title="buffered_stream">buffered_stream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffered_write_stream.html" title="buffered_write_stream">buffered_write_stream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffers_iterator.html" title="buffers_iterator">buffers_iterator</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90772912"></a>Free Functions</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/add_service.html" title="add_service">add_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/asio_handler_allocate.html" title="asio_handler_allocate">asio_handler_allocate</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/asio_handler_deallocate.html" title="asio_handler_deallocate">asio_handler_deallocate</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/asio_handler_invoke.html" title="asio_handler_invoke">asio_handler_invoke</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/asio_handler_is_continuation.html" title="asio_handler_is_continuation">asio_handler_is_continuation</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/async_read.html" title="async_read">async_read</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/async_read_at.html" title="async_read_at">async_read_at</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/async_read_until.html" title="async_read_until">async_read_until</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/async_write.html" title="async_write">async_write</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/async_write_at.html" title="async_write_at">async_write_at</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffer.html" title="buffer">buffer</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffer_cast.html" title="buffer_cast">buffer_cast</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffer_copy.html" title="buffer_copy">buffer_copy</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffer_size.html" title="buffer_size">buffer_size</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffers_begin.html" title="buffers_begin">buffers_begin</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/buffers_end.html" title="buffers_end">buffers_end</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/has_service.html" title="has_service">has_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/read.html" title="read">read</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/read_at.html" title="read_at">read_at</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/read_until.html" title="read_until">read_until</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/spawn.html" title="spawn">spawn</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/transfer_all.html" title="transfer_all">transfer_all</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/transfer_at_least.html" title="transfer_at_least">transfer_at_least</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/transfer_exactly.html" title="transfer_exactly">transfer_exactly</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/use_service.html" title="use_service">use_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/write.html" title="write">write</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/write_at.html" title="write_at">write_at</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90802544"></a>Special Values</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/use_future.html" title="use_future">use_future</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp90805136"></a>Boost.Bind Placeholders</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/placeholders__bytes_transferred.html" title="placeholders::bytes_transferred">placeholders::bytes_transferred</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/placeholders__error.html" title="placeholders::error">placeholders::error</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/placeholders__iterator.html" title="placeholders::iterator">placeholders::iterator</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/placeholders__signal_number.html" title="placeholders::signal_number">placeholders::signal_number</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp90811264"></a>Error Codes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/error__basic_errors.html" title="error::basic_errors">error::basic_errors</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/error__netdb_errors.html" title="error::netdb_errors">error::netdb_errors</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/error__addrinfo_errors.html" title="error::addrinfo_errors">error::addrinfo_errors</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/error__misc_errors.html" title="error::misc_errors">error::misc_errors</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp90817312"></a>Type Traits</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/async_result.html" title="async_result">async_result</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/handler_type.html" title="handler_type">handler_type</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/is_match_condition.html" title="is_match_condition">is_match_condition</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/is_read_buffered.html" title="is_read_buffered">is_read_buffered</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/is_write_buffered.html" title="is_write_buffered">is_write_buffered</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90824928"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/asynchronous_operations.html" title="Requirements on asynchronous operations">Asynchronous operations</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">AsyncRandomAccessWriteDevice</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">AsyncWriteStream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/CompletionHandler.html" title="Completion handler requirements">CompletionHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ConstBufferSequence.html" title="Constant buffer sequence requirements">ConstBufferSequence</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ConvertibleToConstBuffer.html" title="Convertible to const buffer requirements">ConvertibleToConstBuffer</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ConvertibleToMutableBuffer.html" title="Convertible to mutable buffer requirements">ConvertibleToMutableBuffer</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/Handler.html" title="Handlers">Handler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/IoObjectService.html" title="I/O object service requirements">IoObjectService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ReadHandler.html" title="Read handler requirements">ReadHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/Service.html" title="Service requirements">Service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SyncRandomAccessReadDevice.html" title="Buffer-oriented synchronous random-access read device requirements">SyncRandomAccessReadDevice</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SyncRandomAccessWriteDevice.html" title="Buffer-oriented synchronous random-access write device requirements">SyncRandomAccessWriteDevice</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">SyncReadStream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SyncWriteStream.html" title="Buffer-oriented synchronous write stream requirements">SyncWriteStream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/WriteHandler.html" title="Write handler requirements">WriteHandler</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
<table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr><th colspan="4" valign="center">
|
||||
<h3>
|
||||
<a name="idp90851232"></a>Networking</h3>
|
||||
</th></tr></thead>
|
||||
<tbody><tr>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90853312"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/generic__datagram_protocol.html" title="generic::datagram_protocol">generic::datagram_protocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__datagram_protocol/endpoint.html" title="generic::datagram_protocol::endpoint">generic::datagram_protocol::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__datagram_protocol/socket.html" title="generic::datagram_protocol::socket">generic::datagram_protocol::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__raw_protocol.html" title="generic::raw_protocol">generic::raw_protocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__raw_protocol/endpoint.html" title="generic::raw_protocol::endpoint">generic::raw_protocol::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__raw_protocol/socket.html" title="generic::raw_protocol::socket">generic::raw_protocol::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__seq_packet_protocol.html" title="generic::seq_packet_protocol">generic::seq_packet_protocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__seq_packet_protocol/endpoint.html" title="generic::seq_packet_protocol::endpoint">generic::seq_packet_protocol::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__seq_packet_protocol/socket.html" title="generic::seq_packet_protocol::socket">generic::seq_packet_protocol::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__stream_protocol.html" title="generic::stream_protocol">generic::stream_protocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__stream_protocol/endpoint.html" title="generic::stream_protocol::endpoint">generic::stream_protocol::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__stream_protocol/iostream.html" title="generic::stream_protocol::iostream">generic::stream_protocol::iostream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__stream_protocol/socket.html" title="generic::stream_protocol::socket">generic::stream_protocol::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__address.html" title="ip::address">ip::address</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__address_v4.html" title="ip::address_v4">ip::address_v4</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__address_v6.html" title="ip::address_v6">ip::address_v6</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__icmp.html" title="ip::icmp">ip::icmp</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__icmp/endpoint.html" title="ip::icmp::endpoint">ip::icmp::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__icmp/resolver.html" title="ip::icmp::resolver">ip::icmp::resolver</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__icmp/socket.html" title="ip::icmp::socket">ip::icmp::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__resolver_query_base.html" title="ip::resolver_query_base">ip::resolver_query_base</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__tcp.html" title="ip::tcp">ip::tcp</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__tcp/acceptor.html" title="ip::tcp::acceptor">ip::tcp::acceptor</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__tcp/endpoint.html" title="ip::tcp::endpoint">ip::tcp::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__tcp/iostream.html" title="ip::tcp::iostream">ip::tcp::iostream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__tcp/resolver.html" title="ip::tcp::resolver">ip::tcp::resolver</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__tcp/socket.html" title="ip::tcp::socket">ip::tcp::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__udp.html" title="ip::udp">ip::udp</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__udp/endpoint.html" title="ip::udp::endpoint">ip::udp::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__udp/resolver.html" title="ip::udp::resolver">ip::udp::resolver</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__udp/socket.html" title="ip::udp::socket">ip::udp::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base.html" title="socket_base">socket_base</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90889200"></a>Free Functions</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/async_connect.html" title="async_connect">async_connect</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/connect.html" title="connect">connect</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__host_name.html" title="ip::host_name">ip::host_name</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp90893632"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/basic_datagram_socket.html" title="basic_datagram_socket">basic_datagram_socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_deadline_timer.html" title="basic_deadline_timer">basic_deadline_timer</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_raw_socket.html" title="basic_raw_socket">basic_raw_socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_seq_packet_socket.html" title="basic_seq_packet_socket">basic_seq_packet_socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_socket.html" title="basic_socket">basic_socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_socket_acceptor.html" title="basic_socket_acceptor">basic_socket_acceptor</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_socket_iostream.html" title="basic_socket_iostream">basic_socket_iostream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_socket_streambuf.html" title="basic_socket_streambuf">basic_socket_streambuf</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/basic_stream_socket.html" title="basic_stream_socket">basic_stream_socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/generic__basic_endpoint.html" title="generic::basic_endpoint">generic::basic_endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__basic_endpoint.html" title="ip::basic_endpoint">ip::basic_endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__basic_resolver.html" title="ip::basic_resolver">ip::basic_resolver</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__basic_resolver_entry.html" title="ip::basic_resolver_entry">ip::basic_resolver_entry</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__basic_resolver_iterator.html" title="ip::basic_resolver_iterator">ip::basic_resolver_iterator</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__basic_resolver_query.html" title="ip::basic_resolver_query">ip::basic_resolver_query</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp90910688"></a>Services</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/datagram_socket_service.html" title="datagram_socket_service">datagram_socket_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__resolver_service.html" title="ip::resolver_service">ip::resolver_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/raw_socket_service.html" title="raw_socket_service">raw_socket_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/seq_packet_socket_service.html" title="seq_packet_socket_service">seq_packet_socket_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_acceptor_service.html" title="socket_acceptor_service">socket_acceptor_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/stream_socket_service.html" title="stream_socket_service">stream_socket_service</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90919536"></a>Socket Options</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/ip__multicast__enable_loopback.html" title="ip::multicast::enable_loopback">ip::multicast::enable_loopback</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__multicast__hops.html" title="ip::multicast::hops">ip::multicast::hops</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__multicast__join_group.html" title="ip::multicast::join_group">ip::multicast::join_group</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__multicast__leave_group.html" title="ip::multicast::leave_group">ip::multicast::leave_group</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__multicast__outbound_interface.html" title="ip::multicast::outbound_interface">ip::multicast::outbound_interface</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__tcp/no_delay.html" title="ip::tcp::no_delay">ip::tcp::no_delay</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__unicast__hops.html" title="ip::unicast::hops">ip::unicast::hops</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ip__v6_only.html" title="ip::v6_only">ip::v6_only</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/broadcast.html" title="socket_base::broadcast">socket_base::broadcast</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/debug.html" title="socket_base::debug">socket_base::debug</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/do_not_route.html" title="socket_base::do_not_route">socket_base::do_not_route</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/enable_connection_aborted.html" title="socket_base::enable_connection_aborted">socket_base::enable_connection_aborted</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/keep_alive.html" title="socket_base::keep_alive">socket_base::keep_alive</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/linger.html" title="socket_base::linger">socket_base::linger</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/receive_buffer_size.html" title="socket_base::receive_buffer_size">socket_base::receive_buffer_size</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/receive_low_watermark.html" title="socket_base::receive_low_watermark">socket_base::receive_low_watermark</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/reuse_address.html" title="socket_base::reuse_address">socket_base::reuse_address</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/send_buffer_size.html" title="socket_base::send_buffer_size">socket_base::send_buffer_size</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/send_low_watermark.html" title="socket_base::send_low_watermark">socket_base::send_low_watermark</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90943360"></a>I/O Control Commands</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/socket_base/bytes_readable.html" title="socket_base::bytes_readable">socket_base::bytes_readable</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/socket_base/non_blocking_io.html" title="socket_base::non_blocking_io">socket_base::non_blocking_io</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp90947264"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/AcceptHandler.html" title="Accept handler requirements">AcceptHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ComposedConnectHandler.html" title="Composed connect handler requirements">ComposedConnectHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ConnectHandler.html" title="Connect handler requirements">ConnectHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/DatagramSocketService.html" title="Datagram socket service requirements">DatagramSocketService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/Endpoint.html" title="Endpoint requirements">Endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/GettableSocketOption.html" title="Gettable socket option requirements">GettableSocketOption</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/InternetProtocol.html" title="Internet protocol requirements">InternetProtocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/IoControlCommand.html" title="I/O control command requirements">IoControlCommand</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/Protocol.html" title="Protocol requirements">Protocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/RawSocketService.html" title="Raw socket service requirements">RawSocketService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ResolveHandler.html" title="Resolve handler requirements">ResolveHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ResolverService.html" title="Resolver service requirements">ResolverService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SeqPacketSocketService.html" title="Sequenced packet socket service requirements">SeqPacketSocketService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SettableSocketOption.html" title="Settable socket option requirements">SettableSocketOption</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SocketAcceptorService.html" title="Socket acceptor service requirements">SocketAcceptorService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SocketService.html" title="Socket service requirements">SocketService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/StreamSocketService.html" title="Stream socket service requirements">StreamSocketService</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
<table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th valign="center">
|
||||
<h3>
|
||||
<a name="idp90972000"></a>Timers</h3>
|
||||
</th>
|
||||
<th valign="center">
|
||||
<h3>
|
||||
<a name="idp90973824"></a>SSL</h3>
|
||||
</th>
|
||||
<th valign="center">
|
||||
<h3>
|
||||
<a name="idp90975616"></a>Serial Ports</h3>
|
||||
</th>
|
||||
<th valign="center">
|
||||
<h3>
|
||||
<a name="idp90977440"></a>Signal Handling</h3>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90979520"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/deadline_timer.html" title="deadline_timer">deadline_timer</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp90982064"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/basic_deadline_timer.html" title="basic_deadline_timer">basic_deadline_timer</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/time_traits_lt__ptime__gt_.html" title="time_traits< boost::posix_time::ptime >">time_traits</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp90985792"></a>Services</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/deadline_timer_service.html" title="deadline_timer_service">deadline_timer_service</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp90988384"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/TimerService.html" title="Timer service requirements">TimerService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/TimeTraits.html" title="Time traits requirements">TimeTraits</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/WaitHandler.html" title="Wait handler requirements">WaitHandler</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp90993792"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/ssl__context.html" title="ssl::context">ssl::context</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ssl__context_base.html" title="ssl::context_base">ssl::context_base</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ssl__rfc2818_verification.html" title="ssl::rfc2818_verification">ssl::rfc2818_verification</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ssl__stream_base.html" title="ssl::stream_base">ssl::stream_base</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ssl__verify_context.html" title="ssl::verify_context">ssl::verify_context</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91000640"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/ssl__stream.html" title="ssl::stream">ssl::stream</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp91003184"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/BufferedHandshakeHandler.html" title="Buffered handshake handler requirements">BufferedHandshakeHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/HandshakeHandler.html" title="SSL handshake handler requirements">HandshakeHandler</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/ShutdownHandler.html" title="SSL shutdown handler requirements">ShutdownHandler</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp91008720"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/serial_port.html" title="serial_port">serial_port</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/serial_port_base.html" title="serial_port_base">serial_port_base</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91012224"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/basic_serial_port.html" title="basic_serial_port">basic_serial_port</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp91014768"></a>Services</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/serial_port_service.html" title="serial_port_service">serial_port_service</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp91017312"></a>Serial Port Options</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/serial_port_base__baud_rate.html" title="serial_port_base::baud_rate">serial_port_base::baud_rate</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/serial_port_base__flow_control.html" title="serial_port_base::flow_control">serial_port_base::flow_control</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/serial_port_base__parity.html" title="serial_port_base::parity">serial_port_base::parity</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/serial_port_base__stop_bits.html" title="serial_port_base::stop_bits">serial_port_base::stop_bits</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/serial_port_base__character_size.html" title="serial_port_base::character_size">serial_port_base::character_size</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91023920"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/GettableSerialPortOption.html" title="Gettable serial port option requirements">GettableSerialPortOption</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SerialPortService.html" title="Serial port service requirements">SerialPortService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SettableSerialPortOption.html" title="Settable serial port option requirements">SettableSerialPortOption</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp91029408"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/signal_set.html" title="signal_set">signal_set</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp91032000"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/basic_signal_set.html" title="basic_signal_set">basic_signal_set</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp91034720"></a>Services</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/signal_set_service.html" title="signal_set_service">signal_set_service</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp91037328"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/SignalSetService.html" title="Signal set service requirements">SignalSetService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/SignalHandler.html" title="Signal handler requirements">SignalHandler</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
<table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th colspan="2" valign="center">
|
||||
<h3>
|
||||
<a name="idp91045552"></a>POSIX-specific</h3>
|
||||
</th>
|
||||
<th colspan="2" valign="center">
|
||||
<h3>
|
||||
<a name="idp91047376"></a>Windows-specific</h3>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp91049456"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/local__stream_protocol.html" title="local::stream_protocol">local::stream_protocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/local__stream_protocol/acceptor.html" title="local::stream_protocol::acceptor">local::stream_protocol::acceptor</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/local__stream_protocol/endpoint.html" title="local::stream_protocol::endpoint">local::stream_protocol::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/local__stream_protocol/iostream.html" title="local::stream_protocol::iostream">local::stream_protocol::iostream</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/local__stream_protocol/socket.html" title="local::stream_protocol::socket">local::stream_protocol::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/local__datagram_protocol.html" title="local::datagram_protocol">local::datagram_protocol</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/local__datagram_protocol/endpoint.html" title="local::datagram_protocol::endpoint">local::datagram_protocol::endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/local__datagram_protocol/socket.html" title="local::datagram_protocol::socket">local::datagram_protocol::socket</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/posix__descriptor_base.html" title="posix::descriptor_base">posix::descriptor_base</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/posix__stream_descriptor.html" title="posix::stream_descriptor">posix::stream_descriptor</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91061136"></a>Free Functions</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/local__connect_pair.html" title="local::connect_pair">local::connect_pair</a></td></tr></table>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h4>
|
||||
<a name="idp91064352"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/local__basic_endpoint.html" title="local::basic_endpoint">local::basic_endpoint</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/posix__basic_descriptor.html" title="posix::basic_descriptor">posix::basic_descriptor</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/posix__basic_stream_descriptor.html" title="posix::basic_stream_descriptor">posix::basic_stream_descriptor</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91069168"></a>Services</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="reference/posix__stream_descriptor_service.html" title="posix::stream_descriptor_service">posix::stream_descriptor_service</a></td></tr></table>
|
||||
<h4>
|
||||
<a name="idp91071760"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/DescriptorService.html" title="Descriptor service requirements">DescriptorService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/StreamDescriptorService.html" title="Stream descriptor service requirements">StreamDescriptorService</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td colspan="2" valign="top">
|
||||
<h4>
|
||||
<a name="idp91076656"></a>Classes</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/windows__overlapped_ptr.html" title="windows::overlapped_ptr">windows::overlapped_ptr</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/windows__random_access_handle.html" title="windows::random_access_handle">windows::random_access_handle</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/windows__stream_handle.html" title="windows::stream_handle">windows::stream_handle</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91081408"></a>Class Templates</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/windows__basic_handle.html" title="windows::basic_handle">windows::basic_handle</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/windows__basic_random_access_handle.html" title="windows::basic_random_access_handle">windows::basic_random_access_handle</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/windows__basic_stream_handle.html" title="windows::basic_stream_handle">windows::basic_stream_handle</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91086048"></a>Services</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/windows__random_access_handle_service.html" title="windows::random_access_handle_service">windows::random_access_handle_service</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/windows__stream_handle_service.html" title="windows::stream_handle_service">windows::stream_handle_service</a></td></tr>
|
||||
</table>
|
||||
<h4>
|
||||
<a name="idp91089648"></a>Type Requirements</h4>
|
||||
<table border="0" summary="Simple list" class="simplelist">
|
||||
<tr><td><a class="link" href="reference/HandleService.html" title="Handle service requirements">HandleService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/RandomAccessHandleService.html" title="Random access handle service requirements">RandomAccessHandleService</a></td></tr>
|
||||
<tr><td><a class="link" href="reference/StreamHandleService.html" title="Stream handle service requirements">StreamHandleService</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="examples/cpp11_examples.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="reference/asynchronous_operations.html"><img src="../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,84 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Accept handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="asynchronous_operations.html" title="Requirements on asynchronous operations">
|
||||
<link rel="next" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asynchronous_operations.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncRandomAccessReadDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AcceptHandler"></a><a class="link" href="AcceptHandler.html" title="Accept handler requirements">Accept handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An accept handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of an accept handler
|
||||
class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">ec</span><span class="special">)</span></code>,
|
||||
where <code class="computeroutput"><span class="identifier">ec</span></code> is an lvalue of
|
||||
type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">error_code</span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.AcceptHandler.h0"></a>
|
||||
<span><a name="asio.reference.AcceptHandler.examples"></a></span><a class="link" href="AcceptHandler.html#asio.reference.AcceptHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as an accept handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">accept_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
An accept handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">accept_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to an accept handler using <code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">accept_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">acceptor</span><span class="special">.</span><span class="identifier">async_accept</span><span class="special">(...,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">accept_handler</span><span class="special">,</span>
|
||||
<span class="keyword">this</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asynchronous_operations.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncRandomAccessReadDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,138 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Buffer-oriented asynchronous random-access read device requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AcceptHandler.html" title="Accept handler requirements">
|
||||
<link rel="next" href="AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AcceptHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncRandomAccessWriteDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncRandomAccessReadDevice"></a><a class="link" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">Buffer-oriented
|
||||
asynchronous random-access read device requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">a</span></code> denotes
|
||||
an asynchronous random access read device object, <code class="computeroutput"><span class="identifier">o</span></code>
|
||||
denotes an offset of type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> denotes an object satisfying
|
||||
<a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable buffer sequence</a>
|
||||
requirements, and <code class="computeroutput"><span class="identifier">h</span></code> denotes
|
||||
an object satisfying <a class="link" href="ReadHandler.html" title="Read handler requirements">read handler</a>
|
||||
requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncRandomAccessReadDevice.t0"></a><p class="title"><b>Table 1. Buffer-oriented asynchronous random-access read device requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented asynchronous random-access read device requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">io_service</span><span class="special">&</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object through which the <code class="computeroutput"><span class="identifier">async_read_some_at</span></code>
|
||||
handler <code class="computeroutput"><span class="identifier">h</span></code> will
|
||||
be invoked.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_read_some_at</span><span class="special">(</span><span class="identifier">o</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">h</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous operation to read one or more bytes of
|
||||
data from the device <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
at the offset <code class="computeroutput"><span class="identifier">o</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The <code class="computeroutput"><span class="identifier">async_read_some_at</span></code>
|
||||
operation shall always fill a buffer in the sequence completely
|
||||
before proceeding to the next.<br> <br> The implementation
|
||||
shall maintain one or more copies of <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
until such time as the read operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous read operation
|
||||
is invoked,<br> <br> whichever comes first.<br> <br> If
|
||||
the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
read operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
|
||||
that specifies the number of bytes read.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AcceptHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncRandomAccessWriteDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,138 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Buffer-oriented asynchronous random-access write device requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">
|
||||
<link rel="next" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessReadDevice.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncReadStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncRandomAccessWriteDevice"></a><a class="link" href="AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">Buffer-oriented
|
||||
asynchronous random-access write device requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">a</span></code> denotes
|
||||
an asynchronous write stream object, <code class="computeroutput"><span class="identifier">o</span></code>
|
||||
denotes an offset of type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">cb</span></code> denotes an object satisfying
|
||||
<a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant buffer sequence</a>
|
||||
requirements, and <code class="computeroutput"><span class="identifier">h</span></code> denotes
|
||||
an object satisfying <a class="link" href="WriteHandler.html" title="Write handler requirements">write handler</a>
|
||||
requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncRandomAccessWriteDevice.t0"></a><p class="title"><b>Table 2. Buffer-oriented asynchronous random-access write device requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented asynchronous random-access write device requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">io_service</span><span class="special">&</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object through which the <code class="computeroutput"><span class="identifier">async_write_some_at</span></code>
|
||||
handler <code class="computeroutput"><span class="identifier">h</span></code> will
|
||||
be invoked.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_write_some_at</span><span class="special">(</span><span class="identifier">o</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">h</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous operation to write one or more bytes
|
||||
of data to the device <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
at offset <code class="computeroutput"><span class="identifier">o</span></code>. The
|
||||
operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The <code class="computeroutput"><span class="identifier">async_write_some_at</span></code> operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous write operation
|
||||
is invoked,<br> <br> whichever comes first.<br> <br> If
|
||||
the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
write operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
|
||||
that specifies the number of bytes written.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessReadDevice.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncReadStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,134 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Buffer-oriented asynchronous read stream requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">
|
||||
<link rel="next" href="AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessWriteDevice.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncReadStream"></a><a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">Buffer-oriented asynchronous
|
||||
read stream requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">a</span></code> denotes
|
||||
an asynchronous read stream object, <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
denotes an object satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
|
||||
buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">h</span></code>
|
||||
denotes an object satisfying <a class="link" href="ReadHandler.html" title="Read handler requirements">read
|
||||
handler</a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncReadStream.t0"></a><p class="title"><b>Table 3. Buffer-oriented asynchronous read stream requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented asynchronous read stream requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">io_service</span><span class="special">&</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object through which the <code class="computeroutput"><span class="identifier">async_read_some</span></code>
|
||||
handler <code class="computeroutput"><span class="identifier">h</span></code> will
|
||||
be invoked.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">h</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous operation to read one or more bytes of
|
||||
data from the stream <code class="computeroutput"><span class="identifier">a</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The <code class="computeroutput"><span class="identifier">async_read_some</span></code>
|
||||
operation shall always fill a buffer in the sequence completely
|
||||
before proceeding to the next.<br> <br> The implementation
|
||||
shall maintain one or more copies of <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
until such time as the read operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous read operation
|
||||
is invoked,<br> <br> whichever comes first.<br> <br> If
|
||||
the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
read operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
|
||||
that specifies the number of bytes read.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessWriteDevice.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="AsyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,134 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Buffer-oriented asynchronous write stream requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">
|
||||
<link rel="next" href="BufferedHandshakeHandler.html" title="Buffered handshake handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncReadStream.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="BufferedHandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncWriteStream"></a><a class="link" href="AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">Buffer-oriented asynchronous
|
||||
write stream requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">a</span></code> denotes
|
||||
an asynchronous write stream object, <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
denotes an object satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">h</span></code>
|
||||
denotes an object satisfying <a class="link" href="WriteHandler.html" title="Write handler requirements">write
|
||||
handler</a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncWriteStream.t0"></a><p class="title"><b>Table 4. Buffer-oriented asynchronous write stream requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented asynchronous write stream requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">io_service</span><span class="special">&</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object through which the <code class="computeroutput"><span class="identifier">async_write_some</span></code>
|
||||
handler <code class="computeroutput"><span class="identifier">h</span></code> will
|
||||
be invoked.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_write_some</span><span class="special">(</span><span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">h</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous operation to write one or more bytes
|
||||
of data to the stream <code class="computeroutput"><span class="identifier">a</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The <code class="computeroutput"><span class="identifier">async_write_some</span></code> operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous write operation
|
||||
is invoked,<br> <br> whichever comes first.<br> <br> If
|
||||
the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
write operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
|
||||
that specifies the number of bytes written.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncReadStream.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="BufferedHandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Buffered handshake handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">
|
||||
<link rel="next" href="CompletionHandler.html" title="Completion handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncWriteStream.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="CompletionHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.BufferedHandshakeHandler"></a><a class="link" href="BufferedHandshakeHandler.html" title="Buffered handshake handler requirements">Buffered handshake
|
||||
handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A buffered handshake handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of a buffered handshake
|
||||
handler class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">s</span><span class="special">)</span></code>,
|
||||
where <code class="computeroutput"><span class="identifier">ec</span></code> is an lvalue of
|
||||
type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">error_code</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">s</span></code> is an lvalue of type
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">size_t</span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.BufferedHandshakeHandler.h0"></a>
|
||||
<span><a name="asio.reference.BufferedHandshakeHandler.examples"></a></span><a class="link" href="BufferedHandshakeHandler.html#asio.reference.BufferedHandshakeHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a buffered handshake handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handshake_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_transferred</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
A buffered handshake handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">handshake_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_transferred</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a buffered handshake handler
|
||||
using <code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">handshake_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_transferred</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_handshake</span><span class="special">(...,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">handshake_handler</span><span class="special">,</span>
|
||||
<span class="keyword">this</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">bytes_transferred</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncWriteStream.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="CompletionHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,79 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Completion handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="BufferedHandshakeHandler.html" title="Buffered handshake handler requirements">
|
||||
<link rel="next" href="ComposedConnectHandler.html" title="Composed connect handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BufferedHandshakeHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ComposedConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.CompletionHandler"></a><a class="link" href="CompletionHandler.html" title="Completion handler requirements">Completion handler
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A completion handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of a completion
|
||||
handler class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.CompletionHandler.h0"></a>
|
||||
<span><a name="asio.reference.CompletionHandler.examples"></a></span><a class="link" href="CompletionHandler.html#asio.reference.CompletionHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a completion handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">completion_handler</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
A completion handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">completion_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a completion handler using
|
||||
<code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">completion_handler</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">my_io_service</span><span class="special">.</span><span class="identifier">post</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">completion_handler</span><span class="special">,</span> <span class="keyword">this</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BufferedHandshakeHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ComposedConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,96 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Composed connect handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="CompletionHandler.html" title="Completion handler requirements">
|
||||
<link rel="next" href="ConnectHandler.html" title="Connect handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="CompletionHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ComposedConnectHandler"></a><a class="link" href="ComposedConnectHandler.html" title="Composed connect handler requirements">Composed connect
|
||||
handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A composed connect handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of a composed connect
|
||||
handler class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">i</span><span class="special">)</span></code>,
|
||||
where <code class="computeroutput"><span class="identifier">ec</span></code> is an lvalue of
|
||||
type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">error_code</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">i</span></code> is an lvalue of the
|
||||
type <code class="computeroutput"><span class="identifier">Iterator</span></code> used in the
|
||||
corresponding <code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code>
|
||||
or async_connect()` function.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ComposedConnectHandler.h0"></a>
|
||||
<span><a name="asio.reference.ComposedConnectHandler.examples"></a></span><a class="link" href="ComposedConnectHandler.html#asio.reference.ComposedConnectHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a composed connect handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">connect_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
A composed connect handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">connect_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">Iterator</span> <span class="identifier">iterator</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a composed connect handler
|
||||
using <code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">connect_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_connect</span><span class="special">(...,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">connect_handler</span><span class="special">,</span>
|
||||
<span class="keyword">this</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">iterator</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="CompletionHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,84 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Connect handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ComposedConnectHandler.html" title="Composed connect handler requirements">
|
||||
<link rel="next" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ComposedConnectHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConstBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ConnectHandler"></a><a class="link" href="ConnectHandler.html" title="Connect handler requirements">Connect handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A connect handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of a connect handler
|
||||
class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">ec</span><span class="special">)</span></code>,
|
||||
where <code class="computeroutput"><span class="identifier">ec</span></code> is an lvalue of
|
||||
type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">error_code</span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ConnectHandler.h0"></a>
|
||||
<span><a name="asio.reference.ConnectHandler.examples"></a></span><a class="link" href="ConnectHandler.html#asio.reference.ConnectHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a connect handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">connect_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
A connect handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">connect_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a connect handler using <code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">connect_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_connect</span><span class="special">(...,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">connect_handler</span><span class="special">,</span>
|
||||
<span class="keyword">this</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ComposedConnectHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConstBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,238 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Constant buffer sequence requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ConnectHandler.html" title="Connect handler requirements">
|
||||
<link rel="next" href="ConvertibleToConstBuffer.html" title="Convertible to const buffer requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConnectHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConvertibleToConstBuffer.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ConstBufferSequence"></a><a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">Constant buffer sequence
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a class containing objects of type <code class="computeroutput"><span class="identifier">T</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">a</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span></code> and <code class="computeroutput"><span class="identifier">u</span></code>
|
||||
denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ConstBufferSequence.t0"></a><p class="title"><b>Table 5. ConstBufferSequence requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ConstBufferSequence requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">T</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">T</span></code> meets the requirements
|
||||
for <a class="link" href="ConvertibleToConstBuffer.html" title="Convertible to const buffer requirements">ConvertibleToConstBuffer</a>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">const_iterator</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
iterator type pointing to <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
meets the requirements for bidirectional iterators (C++ Std, 24.1.4).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post: <code class="computeroutput"><span class="identifier">equal_const_buffer_seq</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">X</span><span class="special">(</span><span class="identifier">a</span><span class="special">))</span></code> where the binary predicate <code class="computeroutput"><span class="identifier">equal_const_buffer_seq</span></code> is defined
|
||||
as
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">equal_const_buffer_seq</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">x1</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">x2</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span>
|
||||
<span class="identifier">distance</span><span class="special">(</span><span class="identifier">x1</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">x1</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">==</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">x2</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">x2</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">&&</span> <span class="identifier">equal</span><span class="special">(</span><span class="identifier">x1</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">x1</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span>
|
||||
<span class="identifier">x2</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">equal_buffer</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
and the binary predicate <code class="computeroutput"><span class="identifier">equal_buffer</span></code>
|
||||
is defined as
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">equal_buffer</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v2</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">b1</span><span class="special">(</span><span class="identifier">v1</span><span class="special">);</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">b2</span><span class="special">(</span><span class="identifier">v2</span><span class="special">);</span>
|
||||
<span class="keyword">return</span>
|
||||
<span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b1</span><span class="special">)</span>
|
||||
<span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b2</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b2</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">==</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">u</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">u</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">&&</span> <span class="identifier">equal</span><span class="special">(</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span>
|
||||
<span class="identifier">u</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">equal_buffer</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
where the binary predicate <code class="computeroutput"><span class="identifier">equal_buffer</span></code>
|
||||
is defined as
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">equal_buffer</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v2</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">b1</span><span class="special">(</span><span class="identifier">v1</span><span class="special">);</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">b2</span><span class="special">(</span><span class="identifier">v2</span><span class="special">);</span>
|
||||
<span class="keyword">return</span>
|
||||
<span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b1</span><span class="special">)</span>
|
||||
<span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b2</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b2</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(&</span><span class="identifier">a</span><span class="special">)->~</span><span class="identifier">X</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: the destructor is applied to every element of <code class="computeroutput"><span class="identifier">a</span></code>; all the memory is deallocated.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
or convertible to <code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
or convertible to <code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConnectHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConvertibleToConstBuffer.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,219 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Convertible to const buffer requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">
|
||||
<link rel="next" href="ConvertibleToMutableBuffer.html" title="Convertible to mutable buffer requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConstBufferSequence.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConvertibleToMutableBuffer.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ConvertibleToConstBuffer"></a><a class="link" href="ConvertibleToConstBuffer.html" title="Convertible to const buffer requirements">Convertible
|
||||
to const buffer requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type that meets the requirements for convertibility to a const buffer must
|
||||
meet the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3), and the requirements of <code class="computeroutput"><span class="identifier">Assignable</span></code>
|
||||
types (C++ Std, 23.1).
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a class meeting the requirements for convertibility to a const buffer, <code class="computeroutput"><span class="identifier">a</span></code> and <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
denote values of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
and <code class="computeroutput"><span class="identifier">u</span></code>, <code class="computeroutput"><span class="identifier">v</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">w</span></code> denote identifiers.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ConvertibleToConstBuffer.t0"></a><p class="title"><b>Table 6. ConvertibleToConstBuffer requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ConvertibleToConstBuffer requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
postcondition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">v</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">v</span><span class="special">;</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">X</span> <span class="identifier">v</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">X</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">X</span> <span class="identifier">v</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="identifier">const_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConstBufferSequence.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ConvertibleToMutableBuffer.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,220 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Convertible to mutable buffer requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ConvertibleToConstBuffer.html" title="Convertible to const buffer requirements">
|
||||
<link rel="next" href="DatagramSocketService.html" title="Datagram socket service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConvertibleToConstBuffer.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="DatagramSocketService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ConvertibleToMutableBuffer"></a><a class="link" href="ConvertibleToMutableBuffer.html" title="Convertible to mutable buffer requirements">Convertible
|
||||
to mutable buffer requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type that meets the requirements for convertibility to a mutable buffer
|
||||
must meet the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3), and the requirements of <code class="computeroutput"><span class="identifier">Assignable</span></code>
|
||||
types (C++ Std, 23.1).
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a class meeting the requirements for convertibility to a mutable buffer,
|
||||
<code class="computeroutput"><span class="identifier">a</span></code> and <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
denote values of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
and <code class="computeroutput"><span class="identifier">u</span></code>, <code class="computeroutput"><span class="identifier">v</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">w</span></code> denote identifiers.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ConvertibleToMutableBuffer.t0"></a><p class="title"><b>Table 7. ConvertibleToMutableBuffer requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ConvertibleToMutableBuffer requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
postcondition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">mutable_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">v</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">mutable_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">mutable_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">v</span><span class="special">;</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">mutable_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">mutable_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">X</span> <span class="identifier">v</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">mutable_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">X</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">mutable_buffer</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span>
|
||||
<span class="identifier">X</span> <span class="identifier">v</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">w</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">void</span><span class="special">*>(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">u</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConvertibleToConstBuffer.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="DatagramSocketService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,363 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Datagram socket service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ConvertibleToMutableBuffer.html" title="Convertible to mutable buffer requirements">
|
||||
<link rel="next" href="DescriptorService.html" title="Descriptor service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConvertibleToMutableBuffer.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="DescriptorService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.DatagramSocketService"></a><a class="link" href="DatagramSocketService.html" title="Datagram socket service requirements">Datagram socket
|
||||
service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A datagram socket service must meet the requirements for a <a class="link" href="SocketService.html" title="Socket service requirements">socket
|
||||
service</a>, as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a datagram socket service class for protocol <a class="link" href="Protocol.html" title="Protocol requirements"><code class="computeroutput"><span class="identifier">Protocol</span></code></a>, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">b</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">e</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">Protocol</span><span class="special">::</span><span class="identifier">endpoint</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>, <code class="computeroutput"><span class="identifier">f</span></code> denotes a value of type <code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">message_flags</span></code>, <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
denotes a value satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
|
||||
buffer sequence</a> requirements, <code class="computeroutput"><span class="identifier">rh</span></code>
|
||||
denotes a value meeting <a class="link" href="ReadHandler.html" title="Read handler requirements"><code class="computeroutput"><span class="identifier">ReadHandler</span></code></a> requirements, <code class="computeroutput"><span class="identifier">cb</span></code> denotes a value satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">wh</span></code>
|
||||
denotes a value meeting <a class="link" href="WriteHandler.html" title="Write handler requirements"><code class="computeroutput"><span class="identifier">WriteHandler</span></code></a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.DatagramSocketService.t0"></a><p class="title"><b>Table 8. DatagramSocketService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="DatagramSocketService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Reads one or more bytes of data from a connected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
specifies memory where the data should be placed. The operation
|
||||
shall always fill a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes read. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">rh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to read one or more
|
||||
bytes of data from a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> The implementation shall maintain one or more
|
||||
copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
|
||||
such time as the read operation no longer requires access to the
|
||||
memory specified by the buffers in the sequence. The program must
|
||||
ensure the memory is valid until:<br> <br> — the last copy of
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">ReadHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">rh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">receive_from</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Reads one or more bytes of data from an unconnected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
specifies memory where the data should be placed. The operation
|
||||
shall always fill a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes read. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_receive_from</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">rh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to read one or more
|
||||
bytes of data from an unconnected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> The implementation shall maintain one or more
|
||||
copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
|
||||
such time as the read operation no longer requires access to the
|
||||
memory specified by the buffers in the sequence. The program must
|
||||
ensure the memory is valid until:<br> <br> — the last copy of
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> The program must ensure
|
||||
the object <code class="computeroutput"><span class="identifier">e</span></code> is
|
||||
valid until the handler for the asynchronous operation is invoked.<br>
|
||||
<br> If the operation completes successfully, the <code class="computeroutput"><span class="identifier">ReadHandler</span></code> object <code class="computeroutput"><span class="identifier">rh</span></code> is invoked with the number
|
||||
of bytes transferred. Otherwise it is invoked with <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Writes one or more bytes of data to a connected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
specifies memory where the data to be written is located. The operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">wh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to write one or more
|
||||
bytes of data to a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">WriteHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">wh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="keyword">typename</span> <span class="identifier">Protocol</span><span class="special">::</span><span class="identifier">endpoint</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">e</span><span class="special">;</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">send_to</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Writes one or more bytes of data to an unconnected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
specifies memory where the data to be written is located. The operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="keyword">typename</span> <span class="identifier">Protocol</span><span class="special">::</span><span class="identifier">endpoint</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">e</span><span class="special">;</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">async_send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">wh</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to write one or more
|
||||
bytes of data to an unconnected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">WriteHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">wh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConvertibleToMutableBuffer.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="DescriptorService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,316 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Descriptor service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="DatagramSocketService.html" title="Datagram socket service requirements">
|
||||
<link rel="next" href="Endpoint.html" title="Endpoint requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DatagramSocketService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Endpoint.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.DescriptorService"></a><a class="link" href="DescriptorService.html" title="Descriptor service requirements">Descriptor service
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A descriptor service must meet the requirements for an <a class="link" href="IoObjectService.html" title="I/O object service requirements">I/O
|
||||
object service</a> with support for movability, as well as the additional
|
||||
requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a descriptor service class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">ao</span></code> denote values of type
|
||||
<code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">c</span></code> denote values of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">n</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>, <code class="computeroutput"><span class="identifier">i</span></code> denotes a value meeting <a class="link" href="IoControlCommand.html" title="I/O control command requirements"><code class="computeroutput"><span class="identifier">IoControlCommand</span></code></a> requirements, and
|
||||
<code class="computeroutput"><span class="identifier">u</span></code> and <code class="computeroutput"><span class="identifier">v</span></code>
|
||||
denote identifiers.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.DescriptorService.t0"></a><p class="title"><b>Table 9. DescriptorService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="DescriptorService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The implementation-defined native representation of a descriptor.
|
||||
Must satisfy the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3), and the requirements of <code class="computeroutput"><span class="identifier">Assignable</span></code> types (C++ Std, 23.1).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements.<br> post: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">destroy</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. Implicitly cancels asynchronous operations, as if
|
||||
by calling <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. The underlying native representation is moved from
|
||||
<code class="computeroutput"><span class="identifier">c</span></code> to <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_assign</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ao</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. Implicitly cancels asynchronous operations associated
|
||||
with <code class="computeroutput"><span class="identifier">b</span></code>, as if by
|
||||
calling <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">)</span></code>.
|
||||
Then the underlying native representation is moved from <code class="computeroutput"><span class="identifier">c</span></code> to <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br> post: <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span> <span class="special">||</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span><span class="special">&</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
<span class="identifier">u</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">()</span></code>
|
||||
is true, causes any outstanding asynchronous operations to complete
|
||||
as soon as possible. Handlers for cancelled operations shall be
|
||||
passed the error code <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_aborted</span></code>.<br>
|
||||
post: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">native_handle</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">cancel</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
Causes any outstanding asynchronous operations to complete as soon
|
||||
as possible. Handlers for cancelled operations shall be passed
|
||||
the error code <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_aborted</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">io_control</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DatagramSocketService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Endpoint.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,242 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Endpoint requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="DescriptorService.html" title="Descriptor service requirements">
|
||||
<link rel="next" href="GettableSerialPortOption.html" title="Gettable serial port option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DescriptorService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="GettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Endpoint"></a><a class="link" href="Endpoint.html" title="Endpoint requirements">Endpoint requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An endpoint must meet the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3), and the requirements of <code class="computeroutput"><span class="identifier">Assignable</span></code>
|
||||
types (C++ Std, 23.1).
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
an endpoint class, <code class="computeroutput"><span class="identifier">a</span></code> denotes
|
||||
a value of type <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">s</span></code> denotes a size in bytes, and <code class="computeroutput"><span class="identifier">u</span></code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Endpoint.t0"></a><p class="title"><b>Table 10. Endpoint requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Endpoint requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">protocol_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="Protocol.html" title="Protocol requirements">protocol</a>
|
||||
requirements
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span> <span class="identifier">u</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">protocol</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">protocol_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">data</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
a pointer
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>address</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> functions such as <a href="http://www.opengroup.org/onlinepubs/000095399/functions/accept.html" target="_top"><code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getpeername.html" target="_top"><code class="computeroutput"><span class="identifier">getpeername</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockname.html" target="_top"><code class="computeroutput"><span class="identifier">getsockname</span><span class="special">()</span></code></a>
|
||||
and <a href="http://www.opengroup.org/onlinepubs/000095399/functions/recvfrom.html" target="_top"><code class="computeroutput"><span class="identifier">recvfrom</span><span class="special">()</span></code></a>.
|
||||
The implementation shall perform a <code class="computeroutput"><span class="keyword">reinterpret_cast</span></code>
|
||||
on the pointer to convert it to <code class="computeroutput"><span class="identifier">sockaddr</span><span class="special">*</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">u</span>
|
||||
<span class="special">=</span> <span class="identifier">a</span><span class="special">;</span> <span class="identifier">u</span><span class="special">.</span><span class="identifier">data</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
a pointer
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>address</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> functions such as <a href="http://www.opengroup.org/onlinepubs/000095399/functions/connect.html" target="_top"><code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code></a>,
|
||||
or as the <span class="emphasis"><em>dest_addr</em></span> argument to <span class="emphasis"><em>POSIX</em></span>
|
||||
functions such as <a href="http://www.opengroup.org/onlinepubs/000095399/functions/sendto.html" target="_top"><code class="computeroutput"><span class="identifier">sendto</span><span class="special">()</span></code></a>.
|
||||
The implementation shall perform a <code class="computeroutput"><span class="keyword">reinterpret_cast</span></code>
|
||||
on the pointer to convert it to <code class="computeroutput"><span class="keyword">const</span>
|
||||
<span class="identifier">sockaddr</span><span class="special">*</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>address_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> functions such as <a href="http://www.opengroup.org/onlinepubs/000095399/functions/connect.html" target="_top"><code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code></a>,
|
||||
or as the <span class="emphasis"><em>dest_len</em></span> argument to <span class="emphasis"><em>POSIX</em></span>
|
||||
functions such as <a href="http://www.opengroup.org/onlinepubs/000095399/functions/sendto.html" target="_top"><code class="computeroutput"><span class="identifier">sendto</span><span class="special">()</span></code></a>,
|
||||
after appropriate integer conversion has been performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">s</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span>
|
||||
<span class="special">==</span> <span class="identifier">s</span></code><br>
|
||||
Passed the value contained in the <span class="emphasis"><em>address_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> functions such as <a href="http://www.opengroup.org/onlinepubs/000095399/functions/accept.html" target="_top"><code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getpeername.html" target="_top"><code class="computeroutput"><span class="identifier">getpeername</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockname.html" target="_top"><code class="computeroutput"><span class="identifier">getsockname</span><span class="special">()</span></code></a>
|
||||
and <a href="http://www.opengroup.org/onlinepubs/000095399/functions/recvfrom.html" target="_top"><code class="computeroutput"><span class="identifier">recvfrom</span><span class="special">()</span></code></a>,
|
||||
after successful completion of the function. Permitted to throw
|
||||
an exception if the protocol associated with the endpoint object
|
||||
<code class="computeroutput"><span class="identifier">a</span></code> does not support
|
||||
the specified size.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>address_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> functions such as <a href="http://www.opengroup.org/onlinepubs/000095399/functions/accept.html" target="_top"><code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getpeername.html" target="_top"><code class="computeroutput"><span class="identifier">getpeername</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockname.html" target="_top"><code class="computeroutput"><span class="identifier">getsockname</span><span class="special">()</span></code></a>
|
||||
and <a href="http://www.opengroup.org/onlinepubs/000095399/functions/recvfrom.html" target="_top"><code class="computeroutput"><span class="identifier">recvfrom</span><span class="special">()</span></code></a>,
|
||||
after appropriate integer conversion has been performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DescriptorService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="GettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,98 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Gettable serial port option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Endpoint.html" title="Endpoint requirements">
|
||||
<link rel="next" href="GettableSocketOption.html" title="Gettable socket option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Endpoint.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="GettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.GettableSerialPortOption"></a><a class="link" href="GettableSerialPortOption.html" title="Gettable serial port option requirements">Gettable serial
|
||||
port option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a serial port option class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type <code class="computeroutput"><span class="identifier">error_code</span></code>, and <code class="computeroutput"><span class="identifier">s</span></code>
|
||||
denotes a value of implementation-defined type <span class="emphasis"><em><code class="literal">storage</code></em></span>
|
||||
(where <span class="emphasis"><em><code class="literal">storage</code></em></span> is the type <code class="computeroutput"><span class="identifier">DCB</span></code> on Windows and <code class="computeroutput"><span class="identifier">termios</span></code>
|
||||
on <span class="emphasis"><em>POSIX</em></span> platforms), and <code class="computeroutput"><span class="identifier">u</span></code>
|
||||
denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.GettableSerialPortOption.t0"></a><p class="title"><b>Table 11. GettableSerialPortOption requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="GettableSerialPortOption requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">const</span> </code><span class="emphasis"><em><code class="literal">storage</code></em></span><code class="computeroutput"><span class="special">&</span> <span class="identifier">u</span>
|
||||
<span class="special">=</span> <span class="identifier">s</span><span class="special">;</span></code><br> <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">load</span><span class="special">(</span><span class="identifier">u</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Retrieves the value of the serial port option from the storage.<br>
|
||||
<br> If successful, sets <code class="computeroutput"><span class="identifier">ec</span></code>
|
||||
such that <code class="computeroutput"><span class="special">!</span><span class="identifier">ec</span></code>
|
||||
is true. If an error occurred, sets <code class="computeroutput"><span class="identifier">ec</span></code>
|
||||
such that <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span></code>
|
||||
is true. Returns <code class="computeroutput"><span class="identifier">ec</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Endpoint.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="GettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,171 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Gettable socket option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="GettableSerialPortOption.html" title="Gettable serial port option requirements">
|
||||
<link rel="next" href="Handler.html" title="Handlers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSerialPortOption.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Handler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.GettableSocketOption"></a><a class="link" href="GettableSocketOption.html" title="Gettable socket option requirements">Gettable socket
|
||||
option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a socket option class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">p</span></code> denotes a value that meets the <a class="link" href="Protocol.html" title="Protocol requirements">protocol</a> requirements, and <code class="computeroutput"><span class="identifier">u</span></code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.GettableSocketOption.t0"></a><p class="title"><b>Table 12. GettableSocketOption requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="GettableSocketOption requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">level</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>level</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_name</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">data</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
a pointer, convertible to <code class="computeroutput"><span class="keyword">void</span><span class="special">*</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>option_value</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent), after appropriate integer conversion has been
|
||||
performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">s</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="identifier">p</span><span class="special">)</span>
|
||||
<span class="special">==</span> <span class="identifier">s</span></code>.<br>
|
||||
Passed the value contained in the <span class="emphasis"><em>option_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent) after successful completion of the function. Permitted
|
||||
to throw an exception if the socket option object <code class="computeroutput"><span class="identifier">a</span></code> does not support the specified
|
||||
size.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSerialPortOption.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Handler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,294 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Handle service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Handler.html" title="Handlers">
|
||||
<link rel="next" href="HandshakeHandler.html" title="SSL handshake handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Handler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="HandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.HandleService"></a><a class="link" href="HandleService.html" title="Handle service requirements">Handle service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A handle service must meet the requirements for an <a class="link" href="IoObjectService.html" title="I/O object service requirements">I/O
|
||||
object service</a> with support for movability, as well as the additional
|
||||
requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a handle service class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">ao</span></code> denote values of type
|
||||
<code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">c</span></code> denote values of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">n</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>, and <code class="computeroutput"><span class="identifier">u</span></code> and <code class="computeroutput"><span class="identifier">v</span></code>
|
||||
denote identifiers.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.HandleService.t0"></a><p class="title"><b>Table 14. HandleService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="HandleService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The implementation-defined native representation of a handle. Must
|
||||
satisfy the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3), and the requirements of <code class="computeroutput"><span class="identifier">Assignable</span></code> types (C++ Std, 23.1).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements.<br> post: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">destroy</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. Implicitly cancels asynchronous operations, as if
|
||||
by calling <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. The underlying native representation is moved from
|
||||
<code class="computeroutput"><span class="identifier">c</span></code> to <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_assign</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ao</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. Implicitly cancels asynchronous operations associated
|
||||
with <code class="computeroutput"><span class="identifier">b</span></code>, as if by
|
||||
calling <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">)</span></code>.
|
||||
Then the underlying native representation is moved from <code class="computeroutput"><span class="identifier">c</span></code> to <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br> post: <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span> <span class="special">||</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span><span class="special">&</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
<span class="identifier">u</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">()</span></code>
|
||||
is true, causes any outstanding asynchronous operations to complete
|
||||
as soon as possible. Handlers for cancelled operations shall be
|
||||
passed the error code <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_aborted</span></code>.<br>
|
||||
post: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">native_handle</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">cancel</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
Causes any outstanding asynchronous operations to complete as soon
|
||||
as possible. Handlers for cancelled operations shall be passed
|
||||
the error code <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_aborted</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Handler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="HandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,152 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Handlers</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="GettableSocketOption.html" title="Gettable socket option requirements">
|
||||
<link rel="next" href="HandleService.html" title="Handle service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSocketOption.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="HandleService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Handler"></a><a class="link" href="Handler.html" title="Handlers">Handlers</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A handler must meet the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3).
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a handler class, <code class="computeroutput"><span class="identifier">h</span></code> denotes
|
||||
a value of <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">p</span></code> denotes a pointer to a block of allocated
|
||||
memory of type <code class="computeroutput"><span class="keyword">void</span><span class="special">*</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">s</span></code> denotes the size for a
|
||||
block of allocated memory, and <code class="computeroutput"><span class="identifier">f</span></code>
|
||||
denotes a function object taking no arguments.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Handler.t0"></a><p class="title"><b>Table 13. Handler requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Handler requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">asio_handler_allocate</span><span class="special">;</span>
|
||||
<span class="identifier">asio_handler_allocate</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="special">&</span><span class="identifier">h</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span><span class="special">*</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer to a block of memory of size <code class="computeroutput"><span class="identifier">s</span></code>.
|
||||
The pointer must satisfy the same alignment requirements as a pointer
|
||||
returned by <code class="computeroutput"><span class="special">::</span><span class="keyword">operator</span>
|
||||
<span class="keyword">new</span><span class="special">()</span></code>.
|
||||
Throws <code class="computeroutput"><span class="identifier">bad_alloc</span></code>
|
||||
on failure.<br> <br> The <code class="computeroutput"><span class="identifier">asio_handler_allocate</span><span class="special">()</span></code> function is located using argument-dependent
|
||||
lookup. The function <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">asio_handler_allocate</span><span class="special">()</span></code> serves as a default if no user-supplied
|
||||
function is available.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">asio_handler_deallocate</span><span class="special">;</span>
|
||||
<span class="identifier">asio_handler_deallocate</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">s</span><span class="special">,</span> <span class="special">&</span><span class="identifier">h</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Frees a block of memory associated with a pointer <code class="computeroutput"><span class="identifier">p</span></code>, of at least size <code class="computeroutput"><span class="identifier">s</span></code>, that was previously allocated
|
||||
using <code class="computeroutput"><span class="identifier">asio_handler_allocate</span><span class="special">()</span></code>.<br> <br> The <code class="computeroutput"><span class="identifier">asio_handler_deallocate</span><span class="special">()</span></code>
|
||||
function is located using argument-dependent lookup. The function
|
||||
<code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">asio_handler_deallocate</span><span class="special">()</span></code>
|
||||
serves as a default if no user-supplied function is available.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">asio_handler_invoke</span><span class="special">;</span>
|
||||
<span class="identifier">asio_handler_invoke</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">&</span><span class="identifier">h</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes the function object <code class="computeroutput"><span class="identifier">f</span></code>
|
||||
to be executed as if by calling <code class="computeroutput"><span class="identifier">f</span><span class="special">()</span></code>.<br> <br> The <code class="computeroutput"><span class="identifier">asio_handler_invoke</span><span class="special">()</span></code>
|
||||
function is located using argument-dependent lookup. The function
|
||||
<code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">asio_handler_invoke</span><span class="special">()</span></code>
|
||||
serves as a default if no user-supplied function is available.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSocketOption.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="HandleService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,86 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>SSL handshake handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="HandleService.html" title="Handle service requirements">
|
||||
<link rel="next" href="InternetProtocol.html" title="Internet protocol requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="HandleService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="InternetProtocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.HandshakeHandler"></a><a class="link" href="HandshakeHandler.html" title="SSL handshake handler requirements">SSL handshake handler
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A handshake handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of a handshake
|
||||
handler class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">ec</span><span class="special">)</span></code>,
|
||||
where <code class="computeroutput"><span class="identifier">ec</span></code> is an lvalue of
|
||||
type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">error_code</span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.HandshakeHandler.h0"></a>
|
||||
<span><a name="asio.reference.HandshakeHandler.examples"></a></span><a class="link" href="HandshakeHandler.html#asio.reference.HandshakeHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a handshake handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">handshake_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
A handshake handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">handshake_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a handshake handler using
|
||||
<code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">handshake_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">ssl_stream</span><span class="special">.</span><span class="identifier">async_handshake</span><span class="special">(...,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">handshake_handler</span><span class="special">,</span>
|
||||
<span class="keyword">this</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="HandleService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="InternetProtocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,166 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Internet protocol requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="HandshakeHandler.html" title="SSL handshake handler requirements">
|
||||
<link rel="next" href="IoControlCommand.html" title="I/O control command requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="HandshakeHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="IoControlCommand.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.InternetProtocol"></a><a class="link" href="InternetProtocol.html" title="Internet protocol requirements">Internet protocol requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An internet protocol must meet the requirements for a <a class="link" href="Protocol.html" title="Protocol requirements">protocol</a>
|
||||
as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
an internet protocol class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
and <code class="computeroutput"><span class="identifier">b</span></code> denotes a value of
|
||||
type <code class="computeroutput"><span class="identifier">X</span></code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.InternetProtocol.t0"></a><p class="title"><b>Table 15. InternetProtocol requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="InternetProtocol requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">resolver</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The type of a resolver for the protocol.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">v4</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns an object representing the IP version 4 protocol.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">v6</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns an object representing the IP version 6 protocol.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span> <span class="special">==</span>
|
||||
<span class="identifier">b</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
convertible to <code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns whether two protocol objects are equal.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span> <span class="special">!=</span>
|
||||
<span class="identifier">b</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
convertible to <code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns <code class="computeroutput"><span class="special">!(</span><span class="identifier">a</span>
|
||||
<span class="special">==</span> <span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="HandshakeHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="IoControlCommand.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,107 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>I/O control command requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="InternetProtocol.html" title="Internet protocol requirements">
|
||||
<link rel="next" href="IoObjectService.html" title="I/O object service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="InternetProtocol.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="IoObjectService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.IoControlCommand"></a><a class="link" href="IoControlCommand.html" title="I/O control command requirements">I/O control command
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
an I/O control command class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of <code class="computeroutput"><span class="identifier">X</span></code>, and
|
||||
<code class="computeroutput"><span class="identifier">u</span></code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.IoControlCommand.t0"></a><p class="title"><b>Table 16. IoControlCommand requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="IoControlCommand requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">name</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>request</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/ioctl.html" target="_top"><code class="computeroutput"><span class="identifier">ioctl</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">data</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
a pointer, convertible to <code class="computeroutput"><span class="keyword">void</span><span class="special">*</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="InternetProtocol.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="IoObjectService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,172 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>I/O object service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="IoControlCommand.html" title="I/O control command requirements">
|
||||
<link rel="next" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoControlCommand.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="MutableBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.IoObjectService"></a><a class="link" href="IoObjectService.html" title="I/O object service requirements">I/O object service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An I/O object service must meet the requirements for a <a class="link" href="Service.html" title="Service requirements">service</a>,
|
||||
as well as the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
an I/O object service class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">ao</span></code> denote values of type
|
||||
<code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">c</span></code> denote values of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, and <code class="computeroutput"><span class="identifier">u</span></code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.IoObjectService.t0"></a><p class="title"><b>Table 17. IoObjectService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="IoObjectService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span> <span class="identifier">u</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code> has a public
|
||||
default constructor and destructor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">destroy</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: <code class="computeroutput"><span class="identifier">destroy</span><span class="special">()</span></code>
|
||||
will only be called on a value that has previously been initialised
|
||||
with <code class="computeroutput"><span class="identifier">construct</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">move_construct</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: only required for I/O objects that support movability.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_assign</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ao</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: only required for I/O objects that support movability.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoControlCommand.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="MutableBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,238 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Mutable buffer sequence requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="IoObjectService.html" title="I/O object service requirements">
|
||||
<link rel="next" href="ObjectHandleService.html" title="Object handle service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoObjectService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ObjectHandleService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.MutableBufferSequence"></a><a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">Mutable buffer
|
||||
sequence requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a class containing objects of type <code class="computeroutput"><span class="identifier">T</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">a</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span></code> and <code class="computeroutput"><span class="identifier">u</span></code>
|
||||
denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.MutableBufferSequence.t0"></a><p class="title"><b>Table 18. MutableBufferSequence requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="MutableBufferSequence requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">T</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">T</span></code> meets the requirements
|
||||
for <a class="link" href="ConvertibleToMutableBuffer.html" title="Convertible to mutable buffer requirements">ConvertibleToMutableBuffer</a>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">const_iterator</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
iterator type pointing to <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
meets the requirements for bidirectional iterators (C++ Std, 24.1.4).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post: <code class="computeroutput"><span class="identifier">equal_mutable_buffer_seq</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">X</span><span class="special">(</span><span class="identifier">a</span><span class="special">))</span></code> where the binary predicate <code class="computeroutput"><span class="identifier">equal_mutable_buffer_seq</span></code> is defined
|
||||
as
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">equal_mutable_buffer_seq</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">x1</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">x2</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span>
|
||||
<span class="identifier">distance</span><span class="special">(</span><span class="identifier">x1</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">x1</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">==</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">x2</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">x2</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">&&</span> <span class="identifier">equal</span><span class="special">(</span><span class="identifier">x1</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">x1</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span>
|
||||
<span class="identifier">x2</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">equal_buffer</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
and the binary predicate <code class="computeroutput"><span class="identifier">equal_buffer</span></code>
|
||||
is defined as
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">equal_buffer</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v2</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">b1</span><span class="special">(</span><span class="identifier">v1</span><span class="special">);</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">b2</span><span class="special">(</span><span class="identifier">v2</span><span class="special">);</span>
|
||||
<span class="keyword">return</span>
|
||||
<span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b1</span><span class="special">)</span>
|
||||
<span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b2</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b2</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">==</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">u</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">u</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
|
||||
<span class="special">&&</span> <span class="identifier">equal</span><span class="special">(</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span>
|
||||
<span class="identifier">u</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">equal_buffer</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
where the binary predicate <code class="computeroutput"><span class="identifier">equal_buffer</span></code>
|
||||
is defined as
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">equal_buffer</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">v2</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">b1</span><span class="special">(</span><span class="identifier">v1</span><span class="special">);</span>
|
||||
<span class="identifier">mutable_buffer</span> <span class="identifier">b2</span><span class="special">(</span><span class="identifier">v2</span><span class="special">);</span>
|
||||
<span class="keyword">return</span>
|
||||
<span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b1</span><span class="special">)</span>
|
||||
<span class="special">==</span> <span class="identifier">buffer_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">void</span><span class="special">*>(</span><span class="identifier">b2</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b2</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(&</span><span class="identifier">a</span><span class="special">)->~</span><span class="identifier">X</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: the destructor is applied to every element of <code class="computeroutput"><span class="identifier">a</span></code>; all the memory is deallocated.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
or convertible to <code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
or convertible to <code class="computeroutput"><span class="identifier">const_iterator</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoObjectService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ObjectHandleService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,126 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Object handle service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">
|
||||
<link rel="next" href="Protocol.html" title="Protocol requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="MutableBufferSequence.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Protocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ObjectHandleService"></a><a class="link" href="ObjectHandleService.html" title="Object handle service requirements">Object handle service
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An object handle service must meet the requirements for a <a class="link" href="HandleService.html" title="Handle service requirements">handle
|
||||
service</a>, as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
an object handle service class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">b</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">ec</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">error_code</span></code>,
|
||||
and <code class="computeroutput"><span class="identifier">wh</span></code> denotes a value meeting
|
||||
<a class="link" href="WaitHandler.html" title="Wait handler requirements"><code class="computeroutput"><span class="identifier">WaitHandler</span></code></a>
|
||||
requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ObjectHandleService.t0"></a><p class="title"><b>Table 19. ObjectHandleService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ObjectHandleService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">wait</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Synchronously waits for the object represented by handle
|
||||
<code class="computeroutput"><span class="identifier">b</span></code> to become signalled.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">wh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to wait for the object
|
||||
represented by handle <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
to become signalled. The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code> object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="MutableBufferSequence.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Protocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,149 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Protocol requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ObjectHandleService.html" title="Object handle service requirements">
|
||||
<link rel="next" href="RandomAccessHandleService.html" title="Random access handle service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ObjectHandleService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="RandomAccessHandleService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Protocol"></a><a class="link" href="Protocol.html" title="Protocol requirements">Protocol requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A protocol must meet the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3), and the requirements of <code class="computeroutput"><span class="identifier">Assignable</span></code>
|
||||
types (C++ Std, 23.1).
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a protocol class, and <code class="computeroutput"><span class="identifier">a</span></code> denotes
|
||||
a value of <code class="computeroutput"><span class="identifier">X</span></code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Protocol.t0"></a><p class="title"><b>Table 20. Protocol requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Protocol requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">endpoint</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="Endpoint.html" title="Endpoint requirements">endpoint</a>
|
||||
requirements
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">family</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>domain</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/socket.html" target="_top"><code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">type</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>type</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/socket.html" target="_top"><code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">protocol</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>protocol</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/socket.html" target="_top"><code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ObjectHandleService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="RandomAccessHandleService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,238 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Random access handle service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Protocol.html" title="Protocol requirements">
|
||||
<link rel="next" href="RawSocketService.html" title="Raw socket service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Protocol.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="RawSocketService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.RandomAccessHandleService"></a><a class="link" href="RandomAccessHandleService.html" title="Random access handle service requirements">Random access
|
||||
handle service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A random access handle service must meet the requirements for a <a class="link" href="HandleService.html" title="Handle service requirements">handle
|
||||
service</a>, as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a random access handle service class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">b</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">ec</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">error_code</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">o</span></code> denotes an offset of type
|
||||
boost::uint64_t, <code class="computeroutput"><span class="identifier">mb</span></code> denotes
|
||||
a value satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
|
||||
buffer sequence</a> requirements, <code class="computeroutput"><span class="identifier">rh</span></code>
|
||||
denotes a value meeting <a class="link" href="ReadHandler.html" title="Read handler requirements"><code class="computeroutput"><span class="identifier">ReadHandler</span></code></a> requirements, <code class="computeroutput"><span class="identifier">cb</span></code> denotes a value satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">wh</span></code>
|
||||
denotes a value meeting <a class="link" href="WriteHandler.html" title="Write handler requirements"><code class="computeroutput"><span class="identifier">WriteHandler</span></code></a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.RandomAccessHandleService.t0"></a><p class="title"><b>Table 21. RandomAccessHandleService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="RandomAccessHandleService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">read_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">o</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Reads one or more bytes of data from a handle <code class="computeroutput"><span class="identifier">b</span></code> at offset <code class="computeroutput"><span class="identifier">o</span></code>.<br>
|
||||
<br> The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
specifies memory where the data should be placed. The operation
|
||||
shall always fill a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes read. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
If the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">mb</span></code> is <code class="computeroutput"><span class="number">0</span></code>,
|
||||
the function shall return <code class="computeroutput"><span class="number">0</span></code>
|
||||
immediately.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_read_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">o</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">rh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to read one or more
|
||||
bytes of data from a handle <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
at offset <code class="computeroutput"><span class="identifier">o</span></code>. The
|
||||
operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> The implementation shall maintain one or more
|
||||
copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
|
||||
such time as the read operation no longer requires access to the
|
||||
memory specified by the buffers in the sequence. The program must
|
||||
ensure the memory is valid until:<br> <br> — the last copy of
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first. If the total size of all buffers
|
||||
in the sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
read operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
|
||||
that specifies the number of bytes read.<br> <br> If the operation
|
||||
completes successfully, the <code class="computeroutput"><span class="identifier">ReadHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">rh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">write_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">o</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Writes one or more bytes of data to a handle <code class="computeroutput"><span class="identifier">b</span></code> at offset <code class="computeroutput"><span class="identifier">o</span></code>.<br>
|
||||
<br> The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
specifies memory where the data to be written is located. The operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
If the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">cb</span></code> is <code class="computeroutput"><span class="number">0</span></code>,
|
||||
the function shall return <code class="computeroutput"><span class="number">0</span></code>
|
||||
immediately.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_write_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">o</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">wh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to write one or more
|
||||
bytes of data to a handle <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
at offset <code class="computeroutput"><span class="identifier">o</span></code>. The
|
||||
operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first. If the total size of all buffers
|
||||
in the sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code>
|
||||
as the argument to the handler that specifies the number of bytes
|
||||
read.<br> <br> If the operation completes successfully, the
|
||||
<code class="computeroutput"><span class="identifier">WriteHandler</span></code> object
|
||||
<code class="computeroutput"><span class="identifier">wh</span></code> is invoked with
|
||||
the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Protocol.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="RawSocketService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,362 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Raw socket service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="RandomAccessHandleService.html" title="Random access handle service requirements">
|
||||
<link rel="next" href="ReadHandler.html" title="Read handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="RandomAccessHandleService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ReadHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.RawSocketService"></a><a class="link" href="RawSocketService.html" title="Raw socket service requirements">Raw socket service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A raw socket service must meet the requirements for a <a class="link" href="SocketService.html" title="Socket service requirements">socket
|
||||
service</a>, as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a raw socket service class for protocol <a class="link" href="Protocol.html" title="Protocol requirements"><code class="computeroutput"><span class="identifier">Protocol</span></code></a>, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">b</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">e</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">Protocol</span><span class="special">::</span><span class="identifier">endpoint</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>, <code class="computeroutput"><span class="identifier">f</span></code> denotes a value of type <code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">message_flags</span></code>, <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
denotes a value satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
|
||||
buffer sequence</a> requirements, <code class="computeroutput"><span class="identifier">rh</span></code>
|
||||
denotes a value meeting <a class="link" href="ReadHandler.html" title="Read handler requirements"><code class="computeroutput"><span class="identifier">ReadHandler</span></code></a> requirements, <code class="computeroutput"><span class="identifier">cb</span></code> denotes a value satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">wh</span></code>
|
||||
denotes a value meeting <a class="link" href="WriteHandler.html" title="Write handler requirements"><code class="computeroutput"><span class="identifier">WriteHandler</span></code></a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.RawSocketService.t0"></a><p class="title"><b>Table 22. RawSocketService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="RawSocketService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Reads one or more bytes of data from a connected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
specifies memory where the data should be placed. The operation
|
||||
shall always fill a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes read. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">rh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to read one or more
|
||||
bytes of data from a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> The implementation shall maintain one or more
|
||||
copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
|
||||
such time as the read operation no longer requires access to the
|
||||
memory specified by the buffers in the sequence. The program must
|
||||
ensure the memory is valid until:<br> <br> — the last copy of
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">ReadHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">rh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">receive_from</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Reads one or more bytes of data from an unconnected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
specifies memory where the data should be placed. The operation
|
||||
shall always fill a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes read. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_receive_from</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">rh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to read one or more
|
||||
bytes of data from an unconnected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> The implementation shall maintain one or more
|
||||
copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
|
||||
such time as the read operation no longer requires access to the
|
||||
memory specified by the buffers in the sequence. The program must
|
||||
ensure the memory is valid until:<br> <br> — the last copy of
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> The program must ensure
|
||||
the object <code class="computeroutput"><span class="identifier">e</span></code> is
|
||||
valid until the handler for the asynchronous operation is invoked.<br>
|
||||
<br> If the operation completes successfully, the <code class="computeroutput"><span class="identifier">ReadHandler</span></code> object <code class="computeroutput"><span class="identifier">rh</span></code> is invoked with the number
|
||||
of bytes transferred. Otherwise it is invoked with <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Writes one or more bytes of data to a connected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
specifies memory where the data to be written is located. The operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">wh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to write one or more
|
||||
bytes of data to a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">WriteHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">wh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="keyword">typename</span> <span class="identifier">Protocol</span><span class="special">::</span><span class="identifier">endpoint</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">e</span><span class="special">;</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">send_to</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Writes one or more bytes of data to an unconnected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
specifies memory where the data to be written is located. The operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="keyword">typename</span> <span class="identifier">Protocol</span><span class="special">::</span><span class="identifier">endpoint</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">e</span><span class="special">;</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">async_send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">wh</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to write one or more
|
||||
bytes of data to an unconnected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">WriteHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">wh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="RandomAccessHandleService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ReadHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,91 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Read handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="RawSocketService.html" title="Raw socket service requirements">
|
||||
<link rel="next" href="ResolveHandler.html" title="Resolve handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="RawSocketService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ResolveHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ReadHandler"></a><a class="link" href="ReadHandler.html" title="Read handler requirements">Read handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A read handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of a read handler
|
||||
class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">s</span><span class="special">)</span></code>,
|
||||
where <code class="computeroutput"><span class="identifier">ec</span></code> is an lvalue of
|
||||
type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">error_code</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">s</span></code> is an lvalue of type
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">size_t</span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ReadHandler.h0"></a>
|
||||
<span><a name="asio.reference.ReadHandler.examples"></a></span><a class="link" href="ReadHandler.html#asio.reference.ReadHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a read handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">read_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_transferred</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
A read handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">read_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_transferred</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a read handler using <code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">read_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_transferred</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_read</span><span class="special">(...,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">read_handler</span><span class="special">,</span>
|
||||
<span class="keyword">this</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">bytes_transferred</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="RawSocketService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ResolveHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Resolve handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ReadHandler.html" title="Read handler requirements">
|
||||
<link rel="next" href="ResolverService.html" title="Resolver service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ReadHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ResolverService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ResolveHandler"></a><a class="link" href="ResolveHandler.html" title="Resolve handler requirements">Resolve handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A resolve handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput"><span class="identifier">h</span></code> of a resolve handler
|
||||
class should work correctly in the expression <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">i</span><span class="special">)</span></code>,
|
||||
where <code class="computeroutput"><span class="identifier">ec</span></code> is an lvalue of
|
||||
type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">error_code</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">i</span></code> is an lvalue of type
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">></span></code>. <code class="computeroutput"><span class="identifier">InternetProtocol</span></code>
|
||||
is the template parameter of the <a class="link" href="ip__resolver_service.html" title="ip::resolver_service"><code class="computeroutput"><span class="identifier">resolver_service</span></code></a> which is used to
|
||||
initiate the asynchronous operation.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ResolveHandler.h0"></a>
|
||||
<span><a name="asio.reference.ResolveHandler.examples"></a></span><a class="link" href="ResolveHandler.html#asio.reference.ResolveHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a resolve handler:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">resolve_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
A resolve handler function object:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">resolve_handler</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a resolve handler using <code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">my_class</span><span class="special">::</span><span class="identifier">resolve_handler</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">resolver</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">resolver</span><span class="special">.</span><span class="identifier">async_resolve</span><span class="special">(...,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">my_class</span><span class="special">::</span><span class="identifier">resolve_handler</span><span class="special">,</span>
|
||||
<span class="keyword">this</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">error</span><span class="special">,</span>
|
||||
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">placeholders</span><span class="special">::</span><span class="identifier">iterator</span><span class="special">));</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ReadHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ResolverService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,230 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Resolver service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ResolveHandler.html" title="Resolve handler requirements">
|
||||
<link rel="next" href="SeqPacketSocketService.html" title="Sequenced packet socket service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ResolveHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SeqPacketSocketService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ResolverService"></a><a class="link" href="ResolverService.html" title="Resolver service requirements">Resolver service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A resolver service must meet the requirements for an <a class="link" href="IoObjectService.html" title="I/O object service requirements">I/O
|
||||
object service</a>, as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a resolver service class for protocol <code class="computeroutput"><span class="identifier">InternetProtocol</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">a</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">b</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">q</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_query</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">></span></code>,
|
||||
<code class="computeroutput"><span class="identifier">e</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_endpoint</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">></span></code>,
|
||||
<code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>, and <code class="computeroutput"><span class="identifier">h</span></code> denotes a value meeting <a class="link" href="ResolveHandler.html" title="Resolve handler requirements"><code class="computeroutput"><span class="identifier">ResolveHandler</span></code></a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ResolverService.t0"></a><p class="title"><b>Table 23. ResolverService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ResolverService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">destroy</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. Implicitly cancels asynchronous resolve operations,
|
||||
as if by calling <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">cancel</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">cancel</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes any outstanding asynchronous resolve operations to complete
|
||||
as soon as possible. Handlers for cancelled operations shall be
|
||||
passed the error code <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_aborted</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">resolve</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">q</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span>
|
||||
<span class="identifier">InternetProtocol</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
On success, returns an iterator <code class="computeroutput"><span class="identifier">i</span></code>
|
||||
such that <code class="computeroutput"><span class="identifier">i</span> <span class="special">!=</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code>.
|
||||
Otherwise returns <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_resolve</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">q</span><span class="special">,</span> <span class="identifier">h</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous resolve operation that is performed via
|
||||
the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">ResolveHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">h</span></code> shall
|
||||
be invoked with an iterator object <code class="computeroutput"><span class="identifier">i</span></code>
|
||||
such that the condition <code class="computeroutput"><span class="identifier">i</span>
|
||||
<span class="special">!=</span> <span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code> holds. Otherwise it is invoked
|
||||
with <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">resolve</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span>
|
||||
<span class="identifier">InternetProtocol</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
On success, returns an iterator <code class="computeroutput"><span class="identifier">i</span></code>
|
||||
such that <code class="computeroutput"><span class="identifier">i</span> <span class="special">!=</span>
|
||||
<span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code>.
|
||||
Otherwise returns <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_resolve</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">h</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous resolve operation that is performed via
|
||||
the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">ResolveHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">h</span></code> shall
|
||||
be invoked with an iterator object <code class="computeroutput"><span class="identifier">i</span></code>
|
||||
such that the condition <code class="computeroutput"><span class="identifier">i</span>
|
||||
<span class="special">!=</span> <span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code> holds. Otherwise it is invoked
|
||||
with <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span><span class="special"><</span><span class="identifier">InternetProtocol</span><span class="special">>()</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ResolveHandler.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SeqPacketSocketService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,232 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Sequenced packet socket service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ResolverService.html" title="Resolver service requirements">
|
||||
<link rel="next" href="SerialPortService.html" title="Serial port service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ResolverService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SerialPortService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SeqPacketSocketService"></a><a class="link" href="SeqPacketSocketService.html" title="Sequenced packet socket service requirements">Sequenced packet
|
||||
socket service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A sequenced packet socket service must meet the requirements for a <a class="link" href="SocketService.html" title="Socket service requirements">socket service</a>, as well as
|
||||
the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a stream socket service class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">b</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">ec</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">error_code</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">f</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">message_flags</span></code>, <code class="computeroutput"><span class="identifier">g</span></code>
|
||||
denotes an lvalue of type <code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">message_flags</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> denotes a value satisfying
|
||||
<a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable buffer sequence</a>
|
||||
requirements, <code class="computeroutput"><span class="identifier">rh</span></code> denotes
|
||||
a value meeting <a class="link" href="ReadHandler.html" title="Read handler requirements"><code class="computeroutput"><span class="identifier">ReadHandler</span></code></a> requirements, <code class="computeroutput"><span class="identifier">cb</span></code> denotes a value satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">wh</span></code>
|
||||
denotes a value meeting <a class="link" href="WriteHandler.html" title="Write handler requirements"><code class="computeroutput"><span class="identifier">WriteHandler</span></code></a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SeqPacketSocketService.t0"></a><p class="title"><b>Table 24. StreamSocketService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="StreamSocketService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">g</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Reads one or more bytes of data from a connected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
specifies memory where the data should be placed. The operation
|
||||
shall always fill a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, sets <code class="computeroutput"><span class="identifier">g</span></code>
|
||||
to the flags associated with the received data, and returns the
|
||||
number of bytes read. Otherwise, sets <code class="computeroutput"><span class="identifier">g</span></code>
|
||||
to <code class="computeroutput"><span class="number">0</span></code> and returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">g</span><span class="special">,</span>
|
||||
<span class="identifier">rh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to read one or more
|
||||
bytes of data from a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> The implementation shall maintain one or more
|
||||
copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
|
||||
such time as the read operation no longer requires access to the
|
||||
memory specified by the buffers in the sequence. The program must
|
||||
ensure the memory is valid until:<br> <br> — the last copy of
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, sets <code class="computeroutput"><span class="identifier">g</span></code>
|
||||
to the flags associated with the received data, then invokes the
|
||||
<code class="computeroutput"><span class="identifier">ReadHandler</span></code> object
|
||||
<code class="computeroutput"><span class="identifier">rh</span></code> with the number
|
||||
of bytes transferred. Otherwise, sets <code class="computeroutput"><span class="identifier">g</span></code>
|
||||
to <code class="computeroutput"><span class="number">0</span></code> and invokes <code class="computeroutput"><span class="identifier">rh</span></code> with <code class="computeroutput"><span class="number">0</span></code>
|
||||
bytes transferred.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Writes one or more bytes of data to a connected socket
|
||||
<code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
|
||||
The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
specifies memory where the data to be written is located. The operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">wh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to write one or more
|
||||
bytes of data to a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the operation completes
|
||||
successfully, the <code class="computeroutput"><span class="identifier">WriteHandler</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">wh</span></code> is invoked
|
||||
with the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ResolverService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SerialPortService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,556 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Serial port service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SeqPacketSocketService.html" title="Sequenced packet socket service requirements">
|
||||
<link rel="next" href="Service.html" title="Service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SeqPacketSocketService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Service.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SerialPortService"></a><a class="link" href="SerialPortService.html" title="Serial port service requirements">Serial port service
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A serial port service must meet the requirements for an <a class="link" href="IoObjectService.html" title="I/O object service requirements">I/O
|
||||
object service</a> with support for movability, as well as the additional
|
||||
requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a serial port service class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">ao</span></code> denote values of type
|
||||
<code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">d</span></code>
|
||||
denotes a serial port device name of type <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">b</span></code> and <code class="computeroutput"><span class="identifier">c</span></code>
|
||||
denote values of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">n</span></code>
|
||||
denotes a value of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>, <code class="computeroutput"><span class="identifier">s</span></code> denotes a value meeting <a class="link" href="SettableSerialPortOption.html" title="Settable serial port option requirements"><code class="computeroutput"><span class="identifier">SettableSerialPortOption</span></code></a> requirements,
|
||||
<code class="computeroutput"><span class="identifier">g</span></code> denotes a value meeting
|
||||
<a class="link" href="GettableSerialPortOption.html" title="Gettable serial port option requirements"><code class="computeroutput"><span class="identifier">GettableSerialPortOption</span></code></a>
|
||||
requirements, <code class="computeroutput"><span class="identifier">mb</span></code> denotes
|
||||
a value satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
|
||||
buffer sequence</a> requirements, <code class="computeroutput"><span class="identifier">rh</span></code>
|
||||
denotes a value meeting <a class="link" href="ReadHandler.html" title="Read handler requirements"><code class="computeroutput"><span class="identifier">ReadHandler</span></code></a> requirements, <code class="computeroutput"><span class="identifier">cb</span></code> denotes a value satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">wh</span></code>
|
||||
denotes a value meeting <a class="link" href="WriteHandler.html" title="Write handler requirements"><code class="computeroutput"><span class="identifier">WriteHandler</span></code></a> requirements. and
|
||||
<code class="computeroutput"><span class="identifier">u</span></code> and <code class="computeroutput"><span class="identifier">v</span></code>
|
||||
denote identifiers.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SerialPortService.t0"></a><p class="title"><b>Table 25. SerialPortService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="SerialPortService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The implementation-defined native representation of a serial port.
|
||||
Must satisfy the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
|
||||
types (C++ Std, 20.1.3), and the requirements of <code class="computeroutput"><span class="identifier">Assignable</span></code> types (C++ Std, 23.1).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements.<br> post: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">destroy</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. Implicitly cancels asynchronous operations, as if
|
||||
by calling <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_construct</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. The underlying native representation is moved from
|
||||
<code class="computeroutput"><span class="identifier">c</span></code> to <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">move_assign</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ao</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
From <a class="link" href="IoObjectService.html" title="I/O object service requirements">IoObjectService</a>
|
||||
requirements. Implicitly cancels asynchronous operations associated
|
||||
with <code class="computeroutput"><span class="identifier">b</span></code>, as if by
|
||||
calling <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">)</span></code>.
|
||||
Then the underlying native representation is moved from <code class="computeroutput"><span class="identifier">c</span></code> to <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">d</span><span class="special">;</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">open</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br> post: <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span> <span class="special">||</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br> post: <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span> <span class="special">||</span>
|
||||
<span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span><span class="special">&</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
<span class="identifier">u</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">close</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">()</span></code>
|
||||
is true, causes any outstanding asynchronous operations to complete
|
||||
as soon as possible. Handlers for cancelled operations shall be
|
||||
passed the error code <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_aborted</span></code>.<br>
|
||||
post: <code class="computeroutput"><span class="special">!</span><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">native_handle</span><span class="special">(</span><span class="identifier">b</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">native_handle_type</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">cancel</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
Causes any outstanding asynchronous operations to complete as soon
|
||||
as possible. Handlers for cancelled operations shall be passed
|
||||
the error code <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_aborted</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">set_option</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_option</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">g</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span><span class="special">&</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
<span class="identifier">u</span><span class="special">.</span><span class="identifier">get_option</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">g</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">a</span><span class="special">.</span><span class="identifier">send_break</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">read_some</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Reads one or more bytes of data from a serial port <code class="computeroutput"><span class="identifier">b</span></code>.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> If successful, returns the number of bytes read.
|
||||
Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
If the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">mb</span></code> is <code class="computeroutput"><span class="number">0</span></code>,
|
||||
the function shall return <code class="computeroutput"><span class="number">0</span></code>
|
||||
immediately.<br> <br> If the operation completes due to graceful
|
||||
connection closure by the peer, the operation shall fail with
|
||||
<code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">eof</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">mb</span><span class="special">,</span>
|
||||
<span class="identifier">rh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to read one or more
|
||||
bytes of data from a serial port <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The mutable buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
|
||||
memory where the data should be placed. The operation shall always
|
||||
fill a buffer in the sequence completely before proceeding to the
|
||||
next.<br> <br> The implementation shall maintain one or more
|
||||
copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
|
||||
such time as the read operation no longer requires access to the
|
||||
memory specified by the buffers in the sequence. The program must
|
||||
ensure the memory is valid until:<br> <br> — the last copy of
|
||||
<code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first. If the total size of all buffers
|
||||
in the sequence <code class="computeroutput"><span class="identifier">mb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
read operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
|
||||
that specifies the number of bytes read.<br> <br> If the operation
|
||||
completes due to graceful connection closure by the peer, the operation
|
||||
shall fail with <code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">eof</span></code>.<br>
|
||||
<br> If the operation completes successfully, the <code class="computeroutput"><span class="identifier">ReadHandler</span></code> object <code class="computeroutput"><span class="identifier">rh</span></code> is invoked with the number
|
||||
of bytes transferred. Otherwise it is invoked with <code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">write_some</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Writes one or more bytes of data to a serial port <code class="computeroutput"><span class="identifier">b</span></code>.<br> <br> The constant
|
||||
buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
specifies memory where the data to be written is located. The operation
|
||||
shall always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> If successful, returns the number of
|
||||
bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
|
||||
If the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">cb</span></code> is <code class="computeroutput"><span class="number">0</span></code>,
|
||||
the function shall return <code class="computeroutput"><span class="number">0</span></code>
|
||||
immediately.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_write_some</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">cb</span><span class="special">,</span>
|
||||
<span class="identifier">wh</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">void</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
|
||||
<br> Initiates an asynchronous operation to write one or more
|
||||
bytes of data to a serial port <code class="computeroutput"><span class="identifier">b</span></code>.
|
||||
The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
|
||||
object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
|
||||
and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> requirements.<br> <br> The constant buffer
|
||||
sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
|
||||
memory where the data to be written is located. The operation shall
|
||||
always write a buffer in the sequence completely before proceeding
|
||||
to the next.<br> <br> The implementation shall maintain one
|
||||
or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
until such time as the write operation no longer requires access
|
||||
to the memory specified by the buffers in the sequence. The program
|
||||
must ensure the memory is valid until:<br> <br> — the last copy
|
||||
of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
|
||||
or<br> <br> — the handler for the asynchronous operation is invoked,<br>
|
||||
<br> whichever comes first. If the total size of all buffers
|
||||
in the sequence <code class="computeroutput"><span class="identifier">cb</span></code>
|
||||
is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
|
||||
operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code>
|
||||
as the argument to the handler that specifies the number of bytes
|
||||
read.<br> <br> If the operation completes successfully, the
|
||||
<code class="computeroutput"><span class="identifier">WriteHandler</span></code> object
|
||||
<code class="computeroutput"><span class="identifier">wh</span></code> is invoked with
|
||||
the number of bytes transferred. Otherwise it is invoked with
|
||||
<code class="computeroutput"><span class="number">0</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SeqPacketSocketService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="Service.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,65 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SerialPortService.html" title="Serial port service requirements">
|
||||
<link rel="next" href="SettableSerialPortOption.html" title="Settable serial port option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SerialPortService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Service"></a><a class="link" href="Service.html" title="Service requirements">Service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A class is a service if it is publicly derived from another service, or if
|
||||
it is a class derived from <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">service</span></code>
|
||||
and contains a publicly-accessible declaration as follows:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">io_service</span><span class="special">::</span><span class="identifier">id</span> <span class="identifier">id</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
All services define a one-argument constructor that takes a reference to
|
||||
the <code class="computeroutput"><span class="identifier">io_service</span></code> object that
|
||||
owns the service. This constructor is <span class="emphasis"><em>explicit</em></span>, preventing
|
||||
its participation in automatic conversions. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">my_service</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">io_service</span><span class="special">::</span><span class="identifier">service</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">static</span> <span class="identifier">io_service</span><span class="special">::</span><span class="identifier">id</span> <span class="identifier">id</span><span class="special">;</span>
|
||||
<span class="keyword">explicit</span> <span class="identifier">my_service</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">&</span> <span class="identifier">ios</span><span class="special">);</span>
|
||||
<span class="keyword">private</span><span class="special">:</span>
|
||||
<span class="keyword">virtual</span> <span class="keyword">void</span> <span class="identifier">shutdown_service</span><span class="special">();</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
A service's <code class="computeroutput"><span class="identifier">shutdown_service</span></code>
|
||||
member function must cause all copies of user-defined handler objects that
|
||||
are held by the service to be destroyed.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SerialPortService.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,98 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Settable serial port option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Service.html" title="Service requirements">
|
||||
<link rel="next" href="SettableSocketOption.html" title="Settable socket option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Service.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SettableSerialPortOption"></a><a class="link" href="SettableSerialPortOption.html" title="Settable serial port option requirements">Settable serial
|
||||
port option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a serial port option class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">ec</span></code> denotes a value of type <code class="computeroutput"><span class="identifier">error_code</span></code>, and <code class="computeroutput"><span class="identifier">s</span></code>
|
||||
denotes a value of implementation-defined type <span class="emphasis"><em><code class="literal">storage</code></em></span>
|
||||
(where <span class="emphasis"><em><code class="literal">storage</code></em></span> is the type <code class="computeroutput"><span class="identifier">DCB</span></code> on Windows and <code class="computeroutput"><span class="identifier">termios</span></code>
|
||||
on <span class="emphasis"><em>POSIX</em></span> platforms), and <code class="computeroutput"><span class="identifier">u</span></code>
|
||||
denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SettableSerialPortOption.t0"></a><p class="title"><b>Table 26. SettableSerialPortOption requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="SettableSerialPortOption requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">u</span>
|
||||
<span class="special">=</span> <span class="identifier">a</span><span class="special">;</span></code><br> <code class="computeroutput"><span class="identifier">u</span><span class="special">.</span><span class="identifier">store</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">error_code</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Saves the value of the serial port option to the storage.<br>
|
||||
<br> If successful, sets <code class="computeroutput"><span class="identifier">ec</span></code>
|
||||
such that <code class="computeroutput"><span class="special">!</span><span class="identifier">ec</span></code>
|
||||
is true. If an error occurred, sets <code class="computeroutput"><span class="identifier">ec</span></code>
|
||||
such that <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span></code>
|
||||
is true. Returns <code class="computeroutput"><span class="identifier">ec</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Service.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="SettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,152 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Settable socket option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SettableSerialPortOption.html" title="Settable serial port option requirements">
|
||||
<link rel="next" href="ShutdownHandler.html" title="SSL shutdown handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SettableSerialPortOption.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ShutdownHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SettableSocketOption"></a><a class="link" href="SettableSocketOption.html" title="Settable socket option requirements">Settable socket
|
||||
option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
|
||||
a socket option class, <code class="computeroutput"><span class="identifier">a</span></code>
|
||||
denotes a value of <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">p</span></code> denotes a value that meets the <a class="link" href="Protocol.html" title="Protocol requirements">protocol</a> requirements, and <code class="computeroutput"><span class="identifier">u</span></code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SettableSocketOption.t0"></a><p class="title"><b>Table 27. SettableSocketOption requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="SettableSocketOption requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">level</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>level</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">int</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_name</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&</span> <span class="identifier">u</span>
|
||||
<span class="special">=</span> <span class="identifier">a</span><span class="special">;</span> <span class="identifier">u</span><span class="special">.</span><span class="identifier">data</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
a pointer, convertible to <code class="computeroutput"><span class="keyword">const</span>
|
||||
<span class="keyword">void</span><span class="special">*</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>option_value</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">size_t</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/000095399/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent), after appropriate integer conversion has been
|
||||
performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SettableSerialPortOption.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="ShutdownHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue