Question

Is there a way to calculate/get the size of the xmpp packets/messages? I am trying to find out the size of the xmpp packets sent between my openfire server and two clients using smack and xmppframework. My overall aim is to optimize my network performance by experimenting with different payloads.

Was it helpful?

Solution

With Smack you could simply register a PacketListener and check the size of every packet received by counting the bytes as a result of the toXML() method, and use a PacketInterceptor for all outgoing packets.

I would think though that the better approach is to simply use some sort of packet sniffer like WireShark on the network. This is capable of filtering on the specific protocol. No need to get into any specifics with the actual endpoints at all then. Smack, XMPPFramework and Openfire all become irrelevant.

OTHER TIPS

That really depends on what library/framework you're using. Most will allow you to convert a stanza object to an XML string, and then you simply count the length of that string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top