Winsock...
Hi,
I am having a problem with reading the incoming data... i use:
"send (ctClient.ClientSocket, sendbuffer, strlen(sendbuffer), 0);"
to send the data and then to read:
"int err = recv(ctClient.ClientSocket, packet, sizeof(packet), 0 );"
My qestion is: is it possible to only read one packet at once? And if it, how?
Thanks, Zoot
If I read this right then you''re talking about stream sockets. Stream sockets don''t base on packets until a long way down the layers. You don''t read packets but data that was recieved on a stream since the last read() or estalbishing the link.
You basically could try to implement some kind of protocol (like putting the length of the sent data at the beginning of a send-buffer) if you need it. A good point to start at (though perhaps not so much for winsock) would be Beej''s Guide to Network Programming.
You basically could try to implement some kind of protocol (like putting the length of the sent data at the beginning of a send-buffer) if you need it. A good point to start at (though perhaps not so much for winsock) would be Beej''s Guide to Network Programming.
I believe there are no guarantees how much data you will get per call with recv except it will be less than or equal to your declared buffer size. Just keep calling recv until you receive 0 bytes.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement