ts3j icon indicating copy to clipboard operation
ts3j copied to clipboard

Unable to send long Cyrillic messages to chat

Open nodamnway opened this issue 5 years ago • 2 comments

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.

nodamnway avatar Sep 17 '20 02:09 nodamnway

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));

kjzl avatar May 10 '21 03:05 kjzl

Thanks, @kjzl . I'd appreciate a pull request with that change! I might be able to get to it otherwise in time.

Manevolent avatar May 28 '21 16:05 Manevolent