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

            <2025年8月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            導航

            統計

            留言簿(1)

            隨筆分類(77)

            隨筆檔案(58)

            me

            基友

            同行

            業界前輩

            最新隨筆

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            国产精品对白刺激久久久| 久久久免费精品re6| 亚洲精品久久久www| 无码久久精品国产亚洲Av影片 | 合区精品久久久中文字幕一区 | 欧美久久亚洲精品| 久久久久亚洲精品无码蜜桃| 久久精品国产99国产精品| 日韩人妻无码一区二区三区久久| 久久国产精品久久| 久久国语露脸国产精品电影| 久久99精品久久久久久齐齐| 亚洲AV无码久久| 思思久久好好热精品国产| 久久精品国内一区二区三区 | 久久久久久精品免费看SSS| 精品久久久久久久中文字幕| 国产69精品久久久久久人妻精品| 成人精品一区二区久久久| 国产成人精品久久免费动漫| 久久精品一区二区三区AV| 久久狠狠一本精品综合网| 99久久婷婷国产一区二区| 91精品国产综合久久精品| 日韩久久久久久中文人妻 | 久久精品国产亚洲αv忘忧草| 久久国产精品国语对白| 国产精品伊人久久伊人电影| 欧美一区二区精品久久| 久久久国产精品网站| 久久精品国产99国产电影网| 成人久久综合网| 久久香蕉国产线看观看乱码| 国产精品久久久久影视不卡| 国产成人无码久久久精品一| 97久久香蕉国产线看观看| 久久久一本精品99久久精品66| 久久精品人人做人人爽97| 亚洲∧v久久久无码精品| 日韩久久久久久中文人妻| 国产精品9999久久久久|