If a Connection is using version 3.4 and is in 'notSupportingOptionalValues' mode (bind response did not have version parameter) the current implemenation of SMPPPacket.writeTo(OutputStream,boolean) is dead wrong, because it sends a message which contains a invalid message size.
With out current provider this causes connection drops!
Assuming that 'withOptional' is false:
public final void writeTo(OutputStream out, boolean withOptional)
throws java.io.IOException {
this calculates the full length including TLV table !!!
int commandLen = getLength();this sends the full length
SMPPIO.writeInt(commandLen, 4, out);
SMPPIO.writeInt(commandId, 4, out);
SMPPIO.writeInt(commandStatus, 4, out);
SMPPIO.writeInt(sequenceNum, 4, out);
encodeBody(out);
but here we just don't send the data -> server crashes or fills with data from next message!!!
if (withOptional) {
tlvTable.writeTo(out);
}
}
I think it's obvious.
Cheers,
Axel.
Will fix asap.
Fix committed to SVN.