Author | Message | Time |
---|---|---|
Myndfyr | Does anyone know if there's a maximum length on a server packet? [edit]While we're at it, how about to the server? Isn't that one 224? | June 20, 2008, 5:26 AM |
Barabajagal | 224 is the maximum amount of text that can be sent in the chat command, not the maximum packet size. I think the best way to get an answer would be with the readuserdata packet... see if you can request all known records, then try them all twice in the same packet... etc... Edit: Scratch that, it allows up to 32 requests apparently, regardless of packet length. I'm going with 1460 bytes. | June 20, 2008, 6:16 AM |
Myndfyr | Thanks! | June 20, 2008, 9:36 AM |
iago | To be on the safe side, I'd go with 65536 bytes. It can't possibly be longer than that. Relying on 1460 is probably a bad idea, since that might just be a convention and they might eventually add something that goes higher. | June 20, 2008, 1:27 PM |
Ringo | Best bet would be to send a micky mouse packet, like "FF 10 00 70" to see if the server does nothing (waits for the rest of the packet body) or disconnects you, then toy around with the lengh and see if it has a fit over a set lengh. Thats what I would probly do anyway :p | June 20, 2008, 2:23 PM |
Myndfyr | [quote author=iago link=topic=17530.msg178594#msg178594 date=1213968477] To be on the safe side, I'd go with 65536 bytes. It can't possibly be longer than that. Relying on 1460 is probably a bad idea, since that might just be a convention and they might eventually add something that goes higher. [/quote] What I'm actually trying to do is preallocate and pool buffers on the client. I noticed when I was working on my WoW client that, when I attached a profiler, about 70% of my total memory usage was on byte[] objects. Since it's expensive to garbage-collect them, I figure, why not just keep them alive and reuse them? For sending, I think it's safe to cap at 1460 (right now I'm actually capping at 768 based on this feedback). Incoming data I'm capping at 2048. | June 20, 2008, 3:56 PM |
iago | [quote author=MyndFyre[vL] link=topic=17530.msg178596#msg178596 date=1213977374] For sending, I think it's safe to cap at 1460 (right now I'm actually capping at 768 based on this feedback). Incoming data I'm capping at 2048. [/quote] Although it might make the code a little more opaque, you should handle the situation where packets are longer, just in case. | June 20, 2008, 6:25 PM |
Myndfyr | [quote author=iago link=topic=17530.msg178608#msg178608 date=1213986308] [quote author=MyndFyre[vL] link=topic=17530.msg178596#msg178596 date=1213977374] For sending, I think it's safe to cap at 1460 (right now I'm actually capping at 768 based on this feedback). Incoming data I'm capping at 2048. [/quote] Although it might make the code a little more opaque, you should handle the situation where packets are longer, just in case. [/quote] I am; I'm throwing ProtocolViolationException. ;-) | June 21, 2008, 2:05 AM |
iago | I meant, handle them properly. Sending a longer packet isn't a violation of the protocol. | June 21, 2008, 4:45 PM |