[問題] socket停止前,執行我要的動作

看板C_and_CPP (C/C++)作者 (兇奴王者)時間9年前 (2016/05/23 16:47), 9年前編輯推噓3(301)
留言4則, 4人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Linux C 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 今天我開一個Socket接收packet 但如果沒有packet進來,會停在recvfrom()的while loop 我都是按ctrl + C強制停止 有辦法說,我按強制停止前,先執行 sorting(); store(); 我自己寫的function後,在停止嗎? 謝謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.117.89.77 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1463993270.A.C43.html ※ 編輯: FierceBreast (140.117.89.77), 05/23/2016 16:48:01

05/23 17:56, , 1F
select(), non-block
05/23 17:56, 1F

05/23 23:42, , 2F
Signal handle
05/23 23:42, 2F

05/24 04:56, , 3F
Non blocking io
05/24 04:56, 3F

文章代碼(AID): #1NGiEsn3 (C_and_CPP)
文章代碼(AID): #1NGiEsn3 (C_and_CPP)