I don't know what is the disadvantage or advantage of this, but why not receiving the whole packet, then splitting it ? UOX3 does it differently, receiving the first byte, then second "length" WORD, then receives all. What happens if i change this and receive all the packet in the beginning with MAXBUFFER limitation ?
And by the way, why does Receive function uses a do..while at recv() ? Doesn't it already receive it when FD_ISSET successes ?
I want to learn these so i can implement an encryption system.
edit : aww it is weird to ask second question lol. WSAEWOULDBLOCK is the reason.
Why doesn't uox3 receive packets at once ?
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Moved topic to coder forum.
I wish I could give you some of the answers you seek here, but my coding kung-fu is not good enough. The only (and pretty useless) answer I have is "because it's been like that for 10 years!", which obviously does not help in any way, form or shape.
I wish I could give you some of the answers you seek here, but my coding kung-fu is not good enough. The only (and pretty useless) answer I have is "because it's been like that for 10 years!", which obviously does not help in any way, form or shape.
-= Ho Eyo He Hum =-
-
Maarc
- Developer
- Posts: 576
- Joined: Sat Mar 27, 2004 6:22 am
- Location: Fleet, UK
- Has thanked: 0
- Been thanked: 0
- Contact:
Yup, its because of blocking. If you request a read beyond what's been transmitted, it sits there and blocks the thread until it gets to a full buffer.
Given the single threaded nature of UOX, that makes no fun for anyone
Having said that, you'll generally find the packet is likely to be sitting in either hardware or Windows buffers, so its not the worst thing in the world. It's not a big delay, by and large.
FD_ISSET only indicates that there is an operation outstanding on the socket's FD of interest. It doesn't actually do any operation beyond telling you there's something to do.
Given the single threaded nature of UOX, that makes no fun for anyone
Having said that, you'll generally find the packet is likely to be sitting in either hardware or Windows buffers, so its not the worst thing in the world. It's not a big delay, by and large.
FD_ISSET only indicates that there is an operation outstanding on the socket's FD of interest. It doesn't actually do any operation beyond telling you there's something to do.