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

            <2014年1月>
            2930311234
            567891011
            12131415161718
            19202122232425
            2627282930311
            2345678

            導航

            統計

            留言簿(1)

            隨筆分類(77)

            隨筆檔案(58)

            me

            基友

            同行

            業界前輩

            最新隨筆

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            国产激情久久久久影院老熟女| 无码国内精品久久综合88| 亚洲精品无码成人片久久| 麻豆AV一区二区三区久久| 久久AV高清无码| 天天做夜夜做久久做狠狠| 久久夜色精品国产网站| 国产午夜精品理论片久久 | 国产免费久久精品99久久| 亚洲国产成人久久综合区| 99久久人妻无码精品系列| 久久精品国产欧美日韩| 91视频国产91久久久| 久久精品国产精品亚洲| 99久久中文字幕| 亚洲AV无码久久精品狠狠爱浪潮| 国産精品久久久久久久| 丰满少妇高潮惨叫久久久| 狠狠综合久久综合88亚洲| 色综合久久88色综合天天 | 国产精品美女久久久久网| 亚洲中文久久精品无码ww16| 久久精品国产精品亚洲艾草网美妙| 精品久久久久久无码专区| 伊人久久综合成人网| 亚洲Av无码国产情品久久| 久久黄色视频| 理论片午午伦夜理片久久| 国产精品熟女福利久久AV| 久久精品国产91久久综合麻豆自制| 亚洲中文久久精品无码| 99久久无色码中文字幕人妻| 久久精品国产亚洲AV忘忧草18| 理论片午午伦夜理片久久| 欧美久久久久久精选9999| 久久se精品一区精品二区国产| 婷婷综合久久中文字幕| 国内精品久久久久久久久电影网| 精品久久久久久99人妻| 久久精品中文字幕一区| 无码8090精品久久一区|