Linux下的socket編程實踐(六)設置套接字I/O超時的方案

(一)使用alarm 函數設置超時 [cpp]  view plain  copy #include <unistd.h>    unsigned int alarm(unsigned int seconds);    它的主要功能是設置信號傳送鬧鐘。信號SIGALRM在經過seconds指定的秒數後傳送給目前的進程,如果在定時未完成的時間內再次調用了alarm函數,則後一次定時器設置將覆蓋前面的
相關文章
相關標籤/搜索