⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 combine.shar

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 SHAR
📖 第 1 页 / 共 3 页
字号:
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2000-04-09 01:31 EDT by <jcej@chiroptera.tragus.org>.
# Source directory was `/home/jcej/projects/ACE_wrappers/docs/tutorials/015'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    414 -rw-rw-r-- hdr
#    419 -rw-rw-r-- bodies
#   4225 -rw-rw-r-- page01.pre
#    194 -rw-rw-r-- page02.pre
#    318 -rw-rw-r-- page03.pre
#    178 -rw-rw-r-- page04.pre
#    302 -rw-rw-r-- page05.pre
#    415 -rw-rw-r-- page06.pre
#    321 -rw-rw-r-- page07.pre
#    500 -rw-rw-r-- page08.pre
#    638 -rw-rw-r-- page09.pre
#    976 -rw-rw-r-- page10.pre
#    334 -rw-rw-r-- page11.pre
#     49 -rw-rw-r-- page12.pre
#    325 -rw-rw-r-- page13.pre
#    539 -rw-rw-r-- page14.pre
#    769 -rw-rw-r-- page15.pre
#    659 -rw-rw-r-- page16.pre
#    213 -rw-rw-r-- page17.pre
#    372 -rw-rw-r-- page18.pre
#    281 -rw-rw-r-- page19.pre
#    355 -rw-rw-r-- page20.pre
#    151 -rw-rw-r-- page21.pre
#   2563 -rw-rw-r-- page22.pre
#    406 -rw-rw-r-- page04.pst
#    616 -rw-rw-r-- page09.pst
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh16810; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= hdr ==============
if test -f 'hdr' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'hdr' '(file already exists)'
else
  $echo 'x -' extracting 'hdr' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'hdr' &&
<HTML>
<HEAD>
X   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
X   <META NAME="Author" CONTENT="James CE Johnson">
X   <TITLE>ACE Tutorial 015</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
X
<CENTER><B><FONT SIZE=+2>ACE Tutorial 015</FONT></B></CENTER>
X
<CENTER><B><FONT SIZE=+2>Building a protocol stream</FONT></B></CENTER>
X
<P>
<HR WIDTH="100%">
SHAR_EOF
  $shar_touch -am 04090120100 'hdr' &&
  chmod 0664 'hdr' ||
  $echo 'restore of' 'hdr' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'hdr:' 'MD5 check failed'
41322d388f7bb6c8eba031c4a6ab53ce  hdr
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'hdr'`"
    test 414 -eq "$shar_count" ||
    $echo 'hdr:' 'original size' '414,' 'current size' "$shar_count!"
  fi
fi
# ============= bodies ==============
if test -f 'bodies' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'bodies' '(file already exists)'
else
  $echo 'x -' extracting 'bodies' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'bodies' &&
#
# The client application specific files
#
PAGE=2
client.cpp
Client_i.h
Client_i.cpp
#
# The server application specific files
#
server.cpp
Server_i.h
Server_i.cpp
Handler.h
Handler.cpp
#
# The basic protocol stream
#
Protocol_Stream.h
Protocol_Stream.cpp
Protocol_Task.h
Protocol_Task.cpp
#
# Send/Receive objects
#
XXmit.h
XXmit.cpp
Recv.h
Recv.cpp
#
# Protocol objects
#
Compressor.h
Compressor.cpp
Crypt.h
Crypt.cpp
SHAR_EOF
  $shar_touch -am 1022205498 'bodies' &&
  chmod 0664 'bodies' ||
  $echo 'restore of' 'bodies' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'bodies:' 'MD5 check failed'
a6c99d6567b0640ad524b196dc43647e  bodies
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'bodies'`"
    test 419 -eq "$shar_count" ||
    $echo 'bodies:' 'original size' '419,' 'current size' "$shar_count!"
  fi
fi
# ============= page01.pre ==============
if test -f 'page01.pre' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'page01.pre' '(file already exists)'
else
  $echo 'x -' extracting 'page01.pre' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'page01.pre' &&
X
In a typical client/server system you will be sending and receiving
X      data.  That's the whole point after all.
<P>
In the client/server tutorials that we've done so far it was just a
X      matter of sending a buffer of data to the peer.  This was done
X      with the send*() and recv*() methods of the ACE_SOCK* objects.
<P>
In a more robust system, one might want to process the data before
X      sending it to a peer and "unprocess" it after reading from a
X      peer.  These processing steps might include encryption,
X      compression, applying checksums or any number of other actions.
<P>
In this tutorial a Protocol_Stream object is created to encrypt and
X      compress* data being sent between peers.  Both client and server
X      applications are presented as well.  I present the application
level code first and then go into the details of the protocol stream
and it's helper objects.  If the stream stuff in the application logic
is confusing then just read on by and come back to it after the later
discussions.
<P>
Disclaimer:
<br>
<ul>
Several folks have reported problems with this tutorial on Win32.
There are a couple of ways to solve this.  I've chosen to solve it by
using the ACE_Select_Reactor on all platforms instead of taking the
OS-default.
</ul>
<P>
Kirthika's abstract:
<UL>
The Protocol Stream model consists of a stream layer which pushes the
data towards the underlying SOCK_Stream thru the stages of encryption
and compression. This data is received at the other end of the
SOCK_Stream and sent up to its Protocol_Stream layer via the stages of
decompression and decryption and an optional Reader task. This is very
similar to the model of the TCP/IP stack (specifically the datalink to
physical layer portion).
<P>
ACE_Message_Blocks are used to communicate between the client and the
server across the Protocol Stream, which abstracts the protocol
conformance details. The underlying SOCK_Stream is used to set up the
connection using the ACE_SOCK_Connector class. Once the connector
completes its job, the SOCK_Stream pointer is passed on to the
Protocol Stream which now takes over. The Client has put() and get()
methods to send and receive data from the server.
<P>
The server is implemented using the ACE_Acceptor to listen at the port
for connections and a reactor for delegating events to the appropriate
event handler. The handle_input () method of the handler simply allows
the stream to receive the data and hand it over to the Handler_Task (a
derivative of the ACE_Task) which will then process it.
<P>
The implementation of this Protocol Stream model is done using the
ACE_Module class. The module for Xmit/Recv is shoved in first
into the stream, followed by the encryption and compression modules. The
optional Reader if defined is bundled with a dummy task
(ACE_Thru_Task class) into a module. The get() and put() methods do
the job of reading and writing to the Stream. Each module is made up
of a pair of Protocol Tasks. A Protocol Task is a derivative of the
ACE_Task and whose recv() and send() methods need to be filled to
perform the appropriate task.
<P>
The Xmit object derives from the Protocol task and has a send() method
which does the task of transmitting data to the underlying
SOCK_Stream. Keeping the fragmentation and reassembly issues in mind,
block-size is also sent across with the block of data.
The Recv object uses a dummy Message Block to provoke the Protocol
Task object to call the recv() on it. This is done by being
foresighted about the use of mutliple threads instead of a single
thread.
<P>
The compression/decompression is bundled in a single Protocol Task
object with the send () method doing the compression and the recv()
doing the decompression. Similarly, the encrption/decryption is done
using a single Protocol Task object.
<P>
This tutorial provides a glimpse on how to design and implement a
protocol in layers and also revises a lot of what has been learnt until
now from the previous tutorials.
(for instance, Message_Block, Task, Acceptor, Connector, Event_Handler
etc.)
</UL>
<P>
<font size=-1>* Ok, I didn't really implement encryption and
X        compression objects.  I'll leave that as a thought
X        exercise!</font>
SHAR_EOF
  $shar_touch -am 04090120100 'page01.pre' &&
  chmod 0664 'page01.pre' ||
  $echo 'restore of' 'page01.pre' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'page01.pre:' 'MD5 check failed'
693002c5a94ef0d514f8b6c4bf2ea36e  page01.pre
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page01.pre'`"
    test 4225 -eq "$shar_count" ||
    $echo 'page01.pre:' 'original size' '4225,' 'current size' "$shar_count!"
  fi
fi
# ============= page02.pre ==============
if test -f 'page02.pre' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'page02.pre' '(file already exists)'
else
  $echo 'x -' extracting 'page02.pre' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'page02.pre' &&
We'll take a look first at the client application.  As usual, our goal
X      is to keep the main() application as simple as possible and
X      delegate the tricky stuff to another object.
X
<HR>
SHAR_EOF
  $shar_touch -am 04090120100 'page02.pre' &&
  chmod 0664 'page02.pre' ||
  $echo 'restore of' 'page02.pre' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'page02.pre:' 'MD5 check failed'
6a2e64962c95b349625f418502c95952  page02.pre
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page02.pre'`"
    test 194 -eq "$shar_count" ||
    $echo 'page02.pre:' 'original size' '194,' 'current size' "$shar_count!"
  fi
fi
# ============= page03.pre ==============
if test -f 'page03.pre' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'page03.pre' '(file already exists)'
else
  $echo 'x -' extracting 'page03.pre' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'page03.pre' &&
The Client object is designed to hide all of the messy connection
X      logic from it's users.  It also provides put/get methods for
X      sending data to the server and receiving the server's response.
X      Note the Protocol_Stream member that will take care of
X      converting and sending/receiving the data.
<HR>
SHAR_EOF
  $shar_touch -am 04090120100 'page03.pre' &&
  chmod 0664 'page03.pre' ||
  $echo 'restore of' 'page03.pre' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'page03.pre:' 'MD5 check failed'
95326c064b10bbda428d3c967f285760  page03.pre
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page03.pre'`"
    test 318 -eq "$shar_count" ||
    $echo 'page03.pre:' 'original size' '318,' 'current size' "$shar_count!"
  fi
fi
# ============= page04.pre ==============
if test -f 'page04.pre' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'page04.pre' '(file already exists)'
else
  $echo 'x -' extracting 'page04.pre' '(text)'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -