ts3j
ts3j copied to clipboard
Unable to send long Cyrillic messages to chat
I am unable to send long messages in Cyrillic(>215 chars).
client.sendChannelMessage(
client
.getClientInfo(client.getClientId())
.getChannelId(),
StringUtils.repeat("ы", 216)
);
Its resulting packet exceeds MAXIMUM_PACKET_SIZE=500 thus it will be sent fragmented.
Unfortunately it does not work as expected:
Exception in thread "main" java.util.concurrent.TimeoutException: send
at com.github.manevolent.ts3j.protocol.socket.client.AbstractTeamspeakClientSocket.writePacketIntl(AbstractTeamspeakClientSocket.java:513)
at com.github.manevolent.ts3j.protocol.socket.client.AbstractTeamspeakClientSocket.writePacket(AbstractTeamspeakClientSocket.java:350)
at com.github.manevolent.ts3j.protocol.socket.client.AbstractTeamspeakClientSocket.writePacket(AbstractTeamspeakClientSocket.java:322)
at com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket$ClientCommandResponse.ensureSent(LocalTeamspeakClientSocket.java:742)
at com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket.sendCommand(LocalTeamspeakClientSocket.java:579)
at com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket.executeCommand(LocalTeamspeakClientSocket.java:507)
at com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket.executeCommand(LocalTeamspeakClientSocket.java:469)
at com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket.sendChannelMessage(LocalTeamspeakClientSocket.java:1094)
at playground.sender.LongSendFail.main(LongMessagwSendFail.java:34)
Same message can be sent with official TS3 client.
NEW_PROTOCOL flag must be included in all parts of the split packet as stated here: https://github.com/ReSpeak/tsdeclarations/blob/master/ts3protocol.md#15-packet-splitting
adding the following somewhere above Line 78 fixes the issue
// All parts should have NEW_PROTOCOL flag if original Packet has it
piece.getHeader().setPacketFlag(HeaderFlag.NEW_PROTOCOL, packet.getHeader().getPacketFlag(HeaderFlag.NEW_PROTOCOL));
Thanks, @kjzl . I'd appreciate a pull request with that change! I might be able to get to it otherwise in time.