Open jots opened 9 years ago
how can I get Packet to write into a buffer of the exact length that is needed? for instance, now I do:
buf = new Buffer(1024) # too big Packet.write(buf, pre) server.send(buf, 0, buf.length, 53, ns) buf = null
but I think that ends up sending too large packets in most cases. Is there a way to get the "buf" to the correct length before sending?
Packet.write() returns a length which you can use:
var len = Packet.write(buf, pre)
Then use len in send():
server.send(buf, 0, len , 53, ns)
how can I get Packet to write into a buffer of the exact length that is needed? for instance, now I do:
but I think that ends up sending too large packets in most cases. Is there a way to get the "buf" to the correct length before sending?