• <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的各個事件觸發(fā)條件測試

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

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




            附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 閱讀(22851) 評論(0)  編輯 收藏 引用 所屬分類: c++

            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導航

            統(tǒng)計

            留言簿(1)

            隨筆分類(77)

            隨筆檔案(58)

            me

            基友

            同行

            業(yè)界前輩

            最新隨筆

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            久久99热狠狠色精品一区| 国产精品久久成人影院| 亚洲国产精品久久久久久| 久久精品夜夜夜夜夜久久| 亚洲αv久久久噜噜噜噜噜| 2021久久精品免费观看| 久久丫忘忧草产品| 久久乐国产综合亚洲精品| 亚洲人AV永久一区二区三区久久| 欧美久久一区二区三区| 亚洲精品综合久久| 亚洲综合日韩久久成人AV| 亚洲精品国精品久久99热一| 久久婷婷五月综合国产尤物app | 99久久免费国产特黄| 久久电影网2021| 国产ww久久久久久久久久| 久久性精品| 伊人久久大香线焦AV综合影院| 天天爽天天狠久久久综合麻豆| 久久66热人妻偷产精品9| 久久精品国产一区| 亚洲综合久久久| 99久久婷婷国产综合亚洲| 久久av免费天堂小草播放| 日本加勒比久久精品| 亚洲级αV无码毛片久久精品| 大伊人青草狠狠久久| 无码任你躁久久久久久| 91精品国产高清91久久久久久| 97超级碰碰碰碰久久久久| 国内精品伊人久久久影院| av国内精品久久久久影院| 亚洲国产成人精品91久久久 | 久久无码AV一区二区三区| 久久亚洲欧美国产精品 | 欧美激情精品久久久久| 久久人妻少妇嫩草AV蜜桃| 婷婷综合久久中文字幕| 亚洲AV无码1区2区久久| 久久综合九色综合欧美就去吻|