亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? talker.cpp

?? 最新的版本ACE-5.6.8,剛從外文網上搬下,與大家分享.
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// $Id: Talker.cpp 80826 2008-03-04 14:51:23Z wotte $

// ============================================================================
//
// = LIBRARY
//    examples
//
// = FILENAME
//    Talker.cpp
//
// = DESCRIPTION
//
//    This test application tests a wide range of events that can be
//    demultiplexed using various ACE utilities.  Events used include
//    ^C events, reading from STDIN, vanilla Win32 events, thread
//    exits, Reactor notifications, proactive reads, and proactive
//    writes.
//
//    The proactive I/O events are demultiplexed by the ACE_Proactor.
//    The thread exits, notications, and vanilla Win32 events are
//    demultiplexed by the ACE_Reactor.  To enable a single thread
//    to run all these events, the Proactor is integrated with the
//    Reactor.
//
//    The test application prototypes a simple talk program.  Two
//    instances of the application connect.  Input from either console
//    is displayed on the others console also.  Because of the evils
//    of Win32 STDIN, a separate thread is used to read from STDIN.
//    To test the Proactor and Reactor, I/O between the remote
//    processes is performed proactively and interactions between the
//    STDIN thread and the main thread are performed reactively.
//
//    The following description of the test application is in two
//    parts.  The participants section explains the main components
//    involved in the application.  The collaboration section
//    describes how the partipants interact in response to the
//    multiple event types which occur.
//
//    The Reactor test application has the following participants:
//
//    . Reactor -- The Reactor demultiplexes Win32 "waitable"
//    events using WaitForMultipleObjects.
//
//    . Proactor -- The proactor initiates and demultiplexes
//    overlapped I/O operations.  The Proactor registers with the
//    Reactor so that a single-thread can demultiplex all
//    application events.
//
//    . STDIN_Handler -- STDIN_Handler is an Active Object which reads
//    from STDIN and forwards the input to the Peer_Handler.  This
//    runs in a separate thread to make the test more interesting.
//    However, STDIN is "waitable", so in general it can be waited on
//    by the ACE Reactor, thanks MicroSlush!
//
//    . Peer_Handler -- The Peer_Handler connects to another instance
//    of test_reactor.  It Proactively reads and writes data to the
//    peer.  When the STDIN_Handler gives it messages, it fowards them
//    to the remote peer.  When it receives messages from the remote
//    peer, it prints the output to the console.
//
//    The collaborations of the participants are as follows:
//
//    . Initialization
//
//      Peer_Handler -- connects to the remote peer.  It then begins
//      proactively reading from the remote connection.  Note that it
//      will be notified by the Proactor when a read completes.  It
//      also registers a notification strategy with message queue so
//      that it is notified when the STDIN_Handler posts a message
//      onto the queue.
//
//      STDIN_Handler -- STDIN_Handler registers a signal handler for
//      SIGINT.  This just captures the exception so that the kernel
//      doesn't kill our process; We want to exit gracefully.  It also
//      creates an Exit_Hook object which registers the
//      STDIN_Handler's thread handle with the Reactor.  The
//      Exit_Hook will get called back when the STDIN_Handler thread
//      exits.  After registering these, it blocks reading from STDIN.
//
//      Proactor -- is registered with the Reactor.
//
//      The main thread of control waits in the Reactor.
//
//    . STDIN events -- When the STDIN_Handler thread reads from
//    STDIN, it puts the message on Peer_Handler's message queue.  It
//    then returns to reading from STDIN.
//
//    . Message enqueue -- The Reactor thread wakes up and calls
//    Peer_Handler::handle_output.  The Peer_Handler then tries to
//    dequeue a message from its message queue.  If it can, the
//    message is Proactively sent to the remote peer.  Note that the
//    Peer_Handler will be notified with this operation is complete.
//    The Peer_Handler then falls back into the Reactor event loop.
//
//    . Send complete event -- When a proactive send is complete, the
//    Proactor is notified by the Reactor.  The Proactor, in turn,
//    notifies the Peer_Handler.  The Peer_Handler then checks for
//    more messages from the message queue.  If there are any, it
//    tries to send them.  If there are not, it returns to the
//    Reactor event loop.
//
//    . Read complete event -- When a proactive read is complete (the
//    Peer_Handler initiated a proactive read when it connected to the
//    remote peer), the Proactor is notified by the Reactor.  The
//    Proactor, in turn notifies the Peer_Handler.  If the read was
//    successful the Peer_Handler just displays the received msg to
//    the console and reinvokes a proactive read from the network
//    connection.  If the read failed (i.e. the remote peer exited),
//    the Peer_Handler sets a flag to end the event loop and returns.
//    This will cause the application to exit.
//
//    . ^C events -- When the user types ^C at the console, the
//    STDIN_Handler's signal handler will be called.  It does nothing,
//    but as a result of the signal, the STDIN_Handler thread will
//    exit.
//
//    . STDIN_Handler thread exits -- The Exit_Hook will get called
//    back from the Reactor.  Exit_Hook::handle_signal sets a flag
//    to end the event loop and returns.  This will cause the
//    application to exit.
//
//
//    To run example, start an instance of the test with an optional
//    local port argument (as the acceptor). Start the other instance
//    with -h <hostname> and -p <server port>. Type in either the
//    client or server windows and your message should show up in the
//    other window.  Control C to exit.
//
// = AUTHOR
//    Tim Harrison
//    Irfan Pyarali
//
// ============================================================================

#include "ace/OS_main.h"

#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)

#include "ace/Reactor.h"
#include "ace/Reactor_Notification_Strategy.h"
#include "ace/WIN32_Proactor.h"
#include "ace/Proactor.h"
#include "ace/SOCK_Connector.h"
#include "ace/SOCK_Acceptor.h"
#include "ace/Get_Opt.h"
#include "ace/Service_Config.h"
#include "ace/Task.h"
#include "ace/OS_NS_unistd.h"

ACE_RCSID(WFMO_Reactor, Talker, "$Id: Talker.cpp 80826 2008-03-04 14:51:23Z wotte $")

typedef ACE_Task<ACE_MT_SYNCH> MT_TASK;

class Peer_Handler : public MT_TASK, public ACE_Handler
// = TITLE
//     Connect to a server.  Receive messages from STDIN_Handler
//     and forward them to the server using proactive I/O.
{
public:
  // = Initialization methods.
  Peer_Handler (int argc, ACE_TCHAR *argv[]);
  ~Peer_Handler (void);

  //FUZZ: disable check_for_lack_ACE_OS
  int open (void * =0);
  // This method creates the network connection to the remote peer.
  // It does blocking connects and accepts depending on whether a
  // hostname was specified from the command line.
  //FUZZ: enable check_for_lack_ACE_OS

  virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result);
  // This method will be called when an asynchronous read completes on a stream.
  // The remote peer has sent us something.  If it succeeded, print
  // out the message and reinitiate a read.  Otherwise, fail.  In both
  // cases, delete the message sent.

  virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result);
  // This method will be called when an asynchronous write completes on a strea_m.
  // One of our asynchronous writes to the remote peer has completed.
  // Make sure it succeeded and then delete the message.

  virtual ACE_HANDLE handle (void) const;
  // Get the I/O handle used by this <handler>. This method will be
  // called by the ACE_Asynch_* classes when an ACE_INVALID_HANDLE is
  // passed to <open>.

  void handle (ACE_HANDLE);
  // Set the ACE_HANDLE value for this Handler.

  virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
  // We've been removed from the Reactor.

  virtual int handle_output (ACE_HANDLE fd);
  // Called when output events should start.  Note that this is
  // automatically invoked by the
  // <ACE_Reactor_Notificiation_Strategy>.

private:
  ACE_SOCK_Stream stream_;
  // Socket that we have connected to the server.

  ACE_Reactor_Notification_Strategy strategy_;
  // The strategy object that the reactor uses to notify us when
  // something is added to the queue.

  // = Remote peer info.
  ACE_TCHAR *host_;
  // Name of remote host.

  u_short port_;
  // Port number for remote host.

  ACE_Asynch_Read_Stream rd_stream_;
  // Read stream

  ACE_Asynch_Write_Stream wr_stream_;
  // Write stream

  ACE_Message_Block mb_;
  // Message Block for reading from the network
};

class STDIN_Handler : public ACE_Task<ACE_NULL_SYNCH>
// = TITLE
//    Active Object.  Reads from STDIN and passes message blocks to
//    the peer handler.
{
public:
  STDIN_Handler (MT_TASK &ph);
  // Initialization.

  //FUZZ: disable check_for_lack_ACE_OS
  virtual int open (void * = 0);
  // Activate object.

  virtual int close (u_long = 0);
  // Shut down.
  //FUZZ: enable check_for_lack_ACE_OS

  int svc (void);
  // Thread runs here as an active object.

  int handle_close (ACE_HANDLE,
                    ACE_Reactor_Mask);

private:
  static void handler (int signum);
  // Handle a ^C.  (Do nothing, this just illustrates how we can catch
  // signals along with the other things).

  void register_thread_exit_hook (void);
  // Helper function to register with the Reactor for thread exit.

  virtual int handle_signal (int index, siginfo_t *, ucontext_t *);
  // The STDIN thread has exited.  This means the user hit ^C.  We can
  // end the event loop.

  MT_TASK &ph_;
  // Send all input to ph_.

  ACE_HANDLE thr_handle_;
  // Handle of our thread.
};

Peer_Handler::Peer_Handler (int argc, ACE_TCHAR *argv[])
  : strategy_ (ACE_Reactor::instance (),
               this,
               ACE_Event_Handler::WRITE_MASK),
    host_ (0),
    port_ (ACE_DEFAULT_SERVER_PORT),
    mb_ (BUFSIZ)
{
  // This code sets up the message to notify us when a new message is
  // added to the queue.  Actually, the queue notifies Reactor which
  // then notifies us.
  this->msg_queue ()->notification_strategy (&this->strategy_);

  ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("h:p:"));
  int c;

  while ((c = get_opt ()) != EOF)
    {
      switch (c)
        {
        case 'h':
          host_ = get_opt.opt_arg ();
          break;
        case 'p':
          port_ = ACE_OS::atoi (get_opt.opt_arg ());
          break;
        }
    }
}

Peer_Handler::~Peer_Handler (void)
{
}

// This method creates the network connection to the remote peer.  It
// does blocking connects and accepts depending on whether a hostname

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
男男视频亚洲欧美| 肉色丝袜一区二区| 亚洲国产成人av网| 性做久久久久久久免费看| 久久精品欧美一区二区三区麻豆| 欧美一区二区三区四区在线观看| 国产精品久久久久久亚洲伦| 国产美女久久久久| 成人的网站免费观看| 精品国产一区二区精华| 99久久精品国产精品久久 | 91麻豆精品国产综合久久久久久| 日本午夜一本久久久综合| 欧美国产亚洲另类动漫| 欧美精品高清视频| 国产成人综合亚洲91猫咪| 亚洲图片欧美综合| 国产精品全国免费观看高清| 777色狠狠一区二区三区| www.色精品| 日本女优在线视频一区二区| 中文字幕视频一区二区三区久| 5566中文字幕一区二区电影| 91香蕉视频mp4| 国产伦精品一区二区三区免费迷| 亚洲综合激情另类小说区| 欧美激情在线观看视频免费| 日韩视频免费直播| 欧美一卡二卡三卡| 日韩欧美亚洲另类制服综合在线| 欧美男同性恋视频网站| 欧美怡红院视频| 欧美日韩综合在线免费观看| 色婷婷激情综合| 在线观看日韩av先锋影音电影院| 色婷婷综合久久久中文字幕| 91久久精品一区二区二区| 色久优优欧美色久优优| 在线观看日韩高清av| 欧美性受极品xxxx喷水| 欧美日韩亚洲国产综合| 欧美日韩久久不卡| 日韩亚洲国产中文字幕欧美| 91精品午夜视频| 精品日韩在线一区| 国产日韩精品一区二区三区在线| 国产日产欧美一区二区视频| 国产精品久久一级| 亚洲男人都懂的| 亚洲18女电影在线观看| 蜜臀a∨国产成人精品| 久草中文综合在线| 成人性视频免费网站| 色综合天天综合| 欧美吻胸吃奶大尺度电影| 91麻豆精品91久久久久久清纯 | 日韩一区二区三区高清免费看看| 成人av午夜影院| av在线综合网| 色综合久久天天| 欧美顶级少妇做爰| 日韩欧美视频一区| 国产欧美日韩麻豆91| 中文字幕中文在线不卡住| 一区二区欧美国产| 日韩中文字幕亚洲一区二区va在线 | 91精品国产91久久久久久一区二区 | 91亚洲国产成人精品一区二区三| a美女胸又www黄视频久久| 成人久久视频在线观看| 从欧美一区二区三区| 在线观看国产91| 91精品久久久久久久久99蜜臂| 久久这里只有精品视频网| 日本一区二区三区四区在线视频| 亚洲一区二区三区中文字幕在线 | 国产喷白浆一区二区三区| 亚洲视频一二三| 亚洲va欧美va天堂v国产综合| 国产专区欧美精品| 粉嫩av一区二区三区| 欧美午夜精品久久久久久超碰| 在线电影国产精品| 欧美极品xxx| 一二三四区精品视频| 激情av综合网| 暴力调教一区二区三区| 欧美一区二区三区视频| 国产欧美在线观看一区| 性做久久久久久久久| 韩国精品一区二区| 欧美亚洲国产一卡| 精品国产亚洲在线| 亚洲综合色噜噜狠狠| 老鸭窝一区二区久久精品| 一本到一区二区三区| 日韩欧美一区二区不卡| 一区二区成人在线| 极品少妇一区二区三区精品视频| 韩国精品在线观看| 日本韩国精品在线| 色av成人天堂桃色av| 国产校园另类小说区| 中文字幕成人在线观看| 免费不卡在线视频| 国产黄色91视频| 欧美不卡一区二区三区| 2021中文字幕一区亚洲| 日本免费新一区视频| 高清日韩电视剧大全免费| 精品国产成人系列| 亚洲一区二区在线视频| 99久久精品免费看国产| 欧美变态tickling挠脚心| 五月天丁香久久| 成人激情图片网| 国产欧美日本一区二区三区| 日韩av中文在线观看| 午夜久久电影网| 石原莉奈在线亚洲二区| 色域天天综合网| 国产欧美日韩在线看| 精品一区免费av| 91精品视频网| 午夜久久久久久电影| 91网站最新网址| 亚洲精品免费在线| 成人免费看视频| 国产精品人人做人人爽人人添| 久久精品噜噜噜成人88aⅴ| 91精品中文字幕一区二区三区| 亚洲色图欧美在线| 91色在线porny| 国产精品久久久久久久久果冻传媒 | 在线亚洲高清视频| 亚洲天堂av一区| 国内一区二区视频| 精品国产乱码久久久久久老虎 | 精品综合久久久久久8888| 欧美日韩激情一区二区三区| 亚洲超碰97人人做人人爱| 91久久精品日日躁夜夜躁欧美| 一区二区三区在线视频观看58 | 国模少妇一区二区三区| 日韩一级片在线观看| 三级在线观看一区二区| 日韩精品一区二区三区中文精品| 日韩精品成人一区二区三区| 日韩免费看的电影| 日本网站在线观看一区二区三区| 91精品国产综合久久精品图片| 亚洲综合丁香婷婷六月香| 欧美日韩一级视频| 欧美国产一区二区在线观看| 不卡视频免费播放| 久久精品亚洲麻豆av一区二区 | 成人av电影在线网| 亚洲久本草在线中文字幕| 色噜噜狠狠一区二区三区果冻| 性做久久久久久免费观看| 欧美日韩你懂得| 国产在线视频精品一区| 久久久亚洲精品一区二区三区 | 国产精品理论片| 欧美午夜一区二区三区| 亚洲va欧美va人人爽| 久久日一线二线三线suv| 国产·精品毛片| 自拍偷在线精品自拍偷无码专区| 日本高清不卡在线观看| 一区二区三区日韩欧美| 欧美肥胖老妇做爰| 精品一区二区三区在线视频| 国产区在线观看成人精品| 日本中文字幕一区二区视频| 亚洲精品在线三区| 成人视屏免费看| 日韩av在线免费观看不卡| 日韩视频一区二区三区在线播放 | 日韩欧美国产1| 国产成人精品亚洲日本在线桃色| 综合在线观看色| 精品剧情v国产在线观看在线| 国产盗摄视频一区二区三区| 亚洲国产色一区| 久久综合色播五月| 欧美乱妇23p| 国产精品香蕉一区二区三区| 午夜影院在线观看欧美| 精品国产成人在线影院| 欧美日韩亚洲综合在线| 国产一区二区不卡在线| 一区二区三区成人| 久久久久久久免费视频了| 色狠狠一区二区| 成人黄色小视频| 日本aⅴ免费视频一区二区三区| 亚洲欧洲日韩综合一区二区| 欧美高清hd18日本| 色婷婷国产精品|