[問題] 想請問一個socket的問題~
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
c++
問題(Question):
新手最近接觸socket,
一直有個疑問,
在沒有關閉descriptor的情況下,
要如何分離連續寫入多筆資料,
假如有
server A,
client B
A對B寫入三筆資料
current_event.data.fd是 client fd,
write(current_event.data.fd, buffer1, size1);
write(current_event.data.fd, buffer2, size2);
write(current_event.data.fd, buffer3, size3);
而B 接收時要能得知我這是3筆資料,
而不是一筆,
感覺應該是要在之間插入EOF之類的分隔,
不過試了好久都沒有頭緒,
請知道的大大可以告訴我,
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.250.65.124
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1421736044.A.D97.html
→
01/20 14:52, , 1F
01/20 14:52, 1F
→
01/20 16:10, , 2F
01/20 16:10, 2F
→
01/20 16:11, , 3F
01/20 16:11, 3F
→
01/20 16:56, , 4F
01/20 16:56, 4F
→
01/20 23:39, , 5F
01/20 23:39, 5F
→
01/22 07:04, , 6F
01/22 07:04, 6F
→
01/22 07:04, , 7F
01/22 07:04, 7F
→
01/22 07:05, , 8F
01/22 07:05, 8F
→
01/22 07:05, , 9F
01/22 07:05, 9F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章