• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Sheppard Y

            keep thinking keep coding.

            epoll的各個事件觸發條件測試

            2016-07-03 日更新 
            此篇博客已經遷移到新博客,并做行文檢查和優化排版:

            1、listen fd,有新連接請求,觸發EPOLLIN。
            2、對端發送普通數據,觸發EPOLLIN。
            3、帶外數據,只觸發EPOLLPRI。
            4、對端正常關閉(程序里close(),shell下kill或ctr+c),觸發EPOLLIN和EPOLLRDHUP,但是不觸發EPOLLERR和EPOLLHUP。
                關于這點,以前一直以為會觸發EPOLLERR或者EPOLLHUP。
                再man epoll_ctl看下后兩個事件的說明,這兩個應該是本端(server端)出錯才觸發的。
            5、對端異常斷開連接(只測了拔網線),沒觸發任何事件。




            附man:

            EPOLLIN
                          The associated file is available for read(2) operations.
            EPOLLOUT
                          The associated file is available for write(2) operations.
            EPOLLRDHUP
                          Stream  socket peer closed connection, or shut down writing half
                          of connection.  (This flag is especially useful for writing sim-
                          ple code to detect peer shutdown when using Edge Triggered moni-
                          toring.)
            EPOLLPRI
                          There is urgent data available for read(2) operations.
            EPOLLERR
                          Error condition happened  on  the  associated  file  descriptor.
                          epoll_wait(2)  will always wait for this event; it is not neces-
                          sary to set it in events.
            EPOLLHUP
                          Hang  up   happened   on   the   associated   file   descriptor.
                          epoll_wait(2)  will always wait for this event; it is not neces-
                          sary to set it in events.
            EPOLLET
                          Sets  the  Edge  Triggered  behavior  for  the  associated  file
                          descriptor.   The default behavior for epoll is Level Triggered.
                          See epoll(7) for more detailed information about Edge and  Level
                          Triggered event distribution architectures.
            EPOLLONESHOT (since Linux 2.6.2)
                          Sets  the  one-shot behavior for the associated file descriptor.
                          This means that after an event is pulled out with  epoll_wait(2)
                          the  associated  file  descriptor  is internally disabled and no
                          other events will be reported by the epoll interface.  The  user
                          must  call  epoll_ctl() with EPOLL_CTL_MOD to re-enable the file
                          descriptor with a new event mask.

            posted on 2009-03-12 17:17 Sheppard Y 閱讀(22875) 評論(0)  編輯 收藏 引用 所屬分類: c++

            <2008年11月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            30123456

            導航

            統計

            留言簿(1)

            隨筆分類(77)

            隨筆檔案(58)

            me

            基友

            同行

            業界前輩

            最新隨筆

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            久久国产成人精品国产成人亚洲| 国产91色综合久久免费| 久久久久亚洲AV成人网| 久久伊人五月天论坛| 亚洲中文字幕久久精品无码APP | 国产精品久久永久免费| 99久久无码一区人妻| 香蕉久久AⅤ一区二区三区| 欧美午夜精品久久久久免费视| 伊人色综合久久天天| 伊人久久大香线焦AV综合影院| 精品久久人人做人人爽综合 | 久久福利青草精品资源站| 久久久久久午夜精品| 久久www免费人成精品香蕉| 久久婷婷五月综合色高清| 超级碰碰碰碰97久久久久| 久久久久香蕉视频| 99久久亚洲综合精品网站| 亚洲精品无码久久千人斩| 亚洲国产香蕉人人爽成AV片久久| 国产成人久久激情91| 性做久久久久久久| 欧美日韩精品久久免费| 天天影视色香欲综合久久| 国产L精品国产亚洲区久久| 国产亚洲婷婷香蕉久久精品| 91精品国产综合久久婷婷| 人妻精品久久无码专区精东影业| 国产精品美女久久久m| 国产精品伦理久久久久久| 久久精品国产2020| 久久精品国产免费观看三人同眠| 亚洲国产成人久久一区WWW| 久久久久无码精品| 久久久久av无码免费网| 久久精品国产2020| 2022年国产精品久久久久 | 99久久免费国产精精品| 精品无码久久久久久午夜| 久久久久久无码Av成人影院|