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

            基友

            同行

            業界前輩

            最新隨筆

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            欧美精品福利视频一区二区三区久久久精品| 亚洲国产精品无码久久久蜜芽| 日日狠狠久久偷偷色综合96蜜桃 | 国产 亚洲 欧美 另类 久久| 久久精品中文字幕无码绿巨人 | 一级a性色生活片久久无| 久久人人爽人人爽人人片av麻烦 | 无码人妻少妇久久中文字幕蜜桃| 日韩AV无码久久一区二区| 色偷偷888欧美精品久久久| 色99久久久久高潮综合影院| 久久久精品国产| 久久99国产精品久久久| 久久久久无码中| 久久精品国产91久久综合麻豆自制 | 国产999精品久久久久久| 国产精品中文久久久久久久| 久久国产精品无码一区二区三区| 精品精品国产自在久久高清| 武侠古典久久婷婷狼人伊人| 久久国产精品-国产精品| 国产精品久久新婚兰兰| 亚洲国产天堂久久综合网站| 久久久久中文字幕| 久久超乳爆乳中文字幕| 久久人妻AV中文字幕| 久久久久黑人强伦姧人妻| 国产精品久久久久久福利69堂| 亚洲精品无码成人片久久| 色诱久久av| 欧美日韩精品久久久免费观看| 一级做a爰片久久毛片人呢| 日韩精品久久久久久免费| 久久久久国产精品人妻| 亚洲国产成人久久综合碰| 久久久久久极精品久久久| 国产aⅴ激情无码久久| 久久99精品久久久久久秒播| 国产91久久精品一区二区| 亚洲国产精品成人久久| 一本一道久久综合狠狠老|