• <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

            基友

            同行

            業界前輩

            最新隨筆

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            久久久久久久亚洲精品| 久久人人爽人人爽人人片AV不| 99久久精品午夜一区二区| 99麻豆久久久国产精品免费| 香蕉久久一区二区不卡无毒影院 | 色欲久久久天天天综合网精品| 中文无码久久精品| 9191精品国产免费久久| 国内精品伊人久久久影院 | 高清免费久久午夜精品| 亚洲欧美久久久久9999| 999久久久免费精品国产| 色老头网站久久网| 国产精品成人精品久久久| 色婷婷久久综合中文久久蜜桃av| 久久激情五月丁香伊人| 久久久国产精品网站| 久久婷婷成人综合色综合| 国内精品伊人久久久影院| 欧美亚洲日本久久精品| 久久国产香蕉一区精品| 国产成人精品久久一区二区三区| 久久婷婷人人澡人人爽人人爱 | 精品久久久久久久久久久久久久久| 综合人妻久久一区二区精品| 色婷婷综合久久久久中文字幕| 国产精品久久久天天影视香蕉| 99久久婷婷免费国产综合精品| 久久精品亚洲一区二区三区浴池| 久久国产免费直播| 久久精品国产亚洲AV忘忧草18| 日本加勒比久久精品| 久久久午夜精品| 国内精品伊人久久久久777| 久久精品极品盛宴观看| 久久久精品国产免大香伊 | 久久99国产精品久久99| 久久久久久久97| 老司机国内精品久久久久| 88久久精品无码一区二区毛片 | 精品99久久aaa一级毛片|