Async sockets and TCP
assuming that we use Asynchronous TCP sockets with a win32 app :
Will another FD_READ event pop up in your window messages if it didn''t receive the whole buffer "at once" the first time ?
I''ve read in another post the fact that TCP doesn''t guarantee you to receive a ''sent'' buffer in one block and I''ve experienced it during my game developpement.
I think I''ve handled it right, but an answer to my question will certify my doubts.
Thanks in advance :-)
Darkhaven Beta-test stage coming soon.
Yes, another FD_READ will be sent whenever Winsock receives additional data. FD_READ's will also appear in the queue if you read a certain amount of data when a greater amount is available. For example, you may have a network protocol in which an integer marks the beginning and type of a new packet. Winsock receives a full data block, but you only read the integer to ensure that the rest of the data block is of a recognized type. A second FD_READ will be posted just after your integer read to let you know there is more data to be interpreted.
It's also nice to hear that you've actually encountered this behavior in lieu of a "recent" thread.
[edited by - johnnie2 on August 3, 2002 2:14:49 PM]
It's also nice to hear that you've actually encountered this behavior in lieu of a "recent" thread.
[edited by - johnnie2 on August 3, 2002 2:14:49 PM]
________________________________________________"Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C
Yup thanks ![](smile.gif)
That''s exactly what I did and now everything is running fine.
![](smile.gif)
That''s exactly what I did and now everything is running fine.
Darkhaven Beta-test stage coming soon.
The original poster didn''t say he''d actually experienced it, just that he was preparing his source to deal with it should it happen as the Winsock FAQ says it can. It''s still never happened to me.
I''ve also changed my Async TCP Winsock class to be fully buffered just in case. Multiple messages per packet is a much bigger issue since it happens very often.
Maybe it does happen but it''s not frequent (at least on a LAN with the size of the packets I use) as a poster was trying to convince us it was.
Ben
IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Dot Com | Rate My Screenshot ]
I''ve also changed my Async TCP Winsock class to be fully buffered just in case. Multiple messages per packet is a much bigger issue since it happens very often.
Maybe it does happen but it''s not frequent (at least on a LAN with the size of the packets I use) as a poster was trying to convince us it was.
Ben
IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Dot Com | Rate My Screenshot ]
"The original poster didn't say he'd actually experienced it, just that he was preparing his source to deal with it should it happen as the Winsock FAQ says it can. It's still never happened to me."
It HAS happened to me, and it's not really rare on the internet. (It happened to me with some clients (perhaps 15% of the clients who tried out my game) when the buffer was greater than 1,2 kb. It seems that it happens more often on 56k connections but it happened on some DSL connections too (with pings under 100 ms).
"Multiple messages per packet is a much bigger issue since it happens very often."
Not much bigger since you have to deal with both![](smile.gif)
(But yeah you encounter the Nagle's Algorithm more often)
[edited by - Cahaan on August 4, 2002 9:33:54 PM]
It HAS happened to me, and it's not really rare on the internet. (It happened to me with some clients (perhaps 15% of the clients who tried out my game) when the buffer was greater than 1,2 kb. It seems that it happens more often on 56k connections but it happened on some DSL connections too (with pings under 100 ms).
"Multiple messages per packet is a much bigger issue since it happens very often."
Not much bigger since you have to deal with both
![](smile.gif)
(But yeah you encounter the Nagle's Algorithm more often)
[edited by - Cahaan on August 4, 2002 9:33:54 PM]
Darkhaven Beta-test stage coming soon.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement