diff --git a/lib/protocol.js b/lib/protocol.js index 4684e1e..3cee6d1 100644 --- a/lib/protocol.js +++ b/lib/protocol.js @@ -450,6 +450,7 @@ var packets = { var writers = { 'int': IntWriter, 'short': ShortWriter, + 'ushort': UShortWriter, 'byte': ByteWriter, 'ubyte': UByteWriter, 'string': StringWriter, @@ -963,6 +964,15 @@ ShortWriter.prototype.write = function(buffer, offset) { buffer.writeInt16BE(this.value, offset); } +function UShortWriter(value) { + this.value = value; + this.size = 2; +} + +UShortWriter.prototype.write = function(buffer, offset) { + buffer.writeUInt16BE(this.value, offset); +} + function IntWriter(value) { this.value = value; this.size = 4;