看板 PangSir 關於我們 聯絡資訊
1.open file傳回去為html時很正常 為jpg時,type正確是image/jpg,open file也沒問題 但browser沒顯示圖片 問題好像是因為我用fgets去讀file 再用send(socket_fd,buff,length,flags);去送出資料 送出去的東西好像跟我gets拿到的不完全一樣 有沒有人提供可使用的function組合? 2.用select時他好像都不會return,是跟我有用fork有關嗎? select部分的code: struct timeval timeo; fd_set rset; int maxfdp1; FD_ZERO(&rset); timeo.tv_sec = 10; timeo.tv_usec = 0; FD_SET(fileno(fileO), &rset); ^^file* pointer to opened file FD_SET(new_fd, &rset); ^^socket for I/O maxfdp1 = max(fileno(fileO), new_fd) + 1; if ((sel = select(/*FD_SETSIZE*/maxfdp1, &rset, NULL, NULL, &timeo)) == -1 ) printf("sel error\n"); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.252.59 ※ 編輯: maxi326 來自: 140.112.252.59 (05/05 03:20)