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

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

            1、listen fd,有新連接請(qǐng)求,觸發(fā)EPOLLIN。
            2、對(duì)端發(fā)送普通數(shù)據(jù),觸發(fā)EPOLLIN。
            3、帶外數(shù)據(jù),只觸發(fā)EPOLLPRI。
            4、對(duì)端正常關(guān)閉(程序里close(),shell下kill或ctr+c),觸發(fā)EPOLLIN和EPOLLRDHUP,但是不觸發(fā)EPOLLERR和EPOLLHUP。
                關(guān)于這點(diǎn),以前一直以為會(huì)觸發(fā)EPOLLERR或者EPOLLHUP
                再man epoll_ctl看下后兩個(gè)事件的說明,這兩個(gè)應(yīng)該是本端(server端)出錯(cuò)才觸發(fā)的。
            5、對(duì)端異常斷開連接(只測(cè)了拔網(wǎng)線),沒觸發(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 閱讀(22875) 評(píng)論(0)  編輯 收藏 引用 所屬分類: c++

            <2013年4月>
            31123456
            78910111213
            14151617181920
            21222324252627
            2829301234
            567891011

            導(dǎo)航

            統(tǒng)計(jì)

            留言簿(1)

            隨筆分類(77)

            隨筆檔案(58)

            me

            基友

            同行

            業(yè)界前輩

            最新隨筆

            搜索

            積分與排名

            最新評(píng)論

            閱讀排行榜

            亚洲国产精品无码久久久秋霞2 | 国产亚洲欧美精品久久久| 区久久AAA片69亚洲| 久久精品九九亚洲精品| 久久久精品久久久久久 | 午夜精品久久久久久久久| 热久久这里只有精品| 久久狠狠爱亚洲综合影院| 国产精品无码久久久久| 久久精品麻豆日日躁夜夜躁| 少妇久久久久久被弄到高潮 | 久久天天躁狠狠躁夜夜2020一| 久久se精品一区精品二区| 久久亚洲精品国产亚洲老地址| 国产国产成人精品久久| 久久综合国产乱子伦精品免费| 久久亚洲国产精品五月天婷| 久久er热视频在这里精品| 99精品久久久久久久婷婷| 无码任你躁久久久久久| 久久精品国产WWW456C0M| 久久国产精品-国产精品| 久久精品亚洲日本波多野结衣| 久久综合精品国产一区二区三区| 国产精品久久国产精品99盘| 国产精品9999久久久久| 亚洲精品乱码久久久久久蜜桃不卡| 久久久久综合国产欧美一区二区| 国产免费久久精品99久久| 女人香蕉久久**毛片精品| 99精品国产在热久久| 国产午夜精品理论片久久影视| 国产精品久久久久天天影视| AV狠狠色丁香婷婷综合久久| 日本久久久久亚洲中字幕| 久久一日本道色综合久久| 人妻无码αv中文字幕久久| 2021久久国自产拍精品| 亚洲综合精品香蕉久久网97| 久久激情亚洲精品无码?V| 欧美日韩成人精品久久久免费看|