Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
ayyrk #1
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: Bytes Sent and Received
Is it correct to use the socket send/receive callbacks to count the number of bytes actually sent and received by the client?

Or is the data compressed before it's put on the wire?

I'd like to get an idea of how much traffic is being generated by my application.

For example:

bytes sent: xxxx    bytes received: xxxx


Again, thanks and best regards,
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello ayyrk,

This is only correct if you don't use xmpp stream compression (XmppCon.UseCompression == true if supported also by your server), and if you have no Tls compression.

agsXMPP supports compression. If compression is enabled the data is compressed before sending and uncompressed when received. To get this stats you have to modify the course code in ClientSocket.cs and add additional events handlers for your stats.

XMPP is using Tls as security layer. Tls has build in compression, which means if the Tls compression is used your stats will also we wrong. You can't get stats from Tls/Ssl encryped connection because the .Net we read from the SslStream which automatically encrypts and decompresses the data for us. I don't think there is a way to get the unencrypted compressed data.

So I would use a sniffer like Wireshark.

Alex
Avatar
ayyrk #3
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Alex,

I am running on WM5 against OpenFire with this code snippet:

_connection.UseCompression = true;

// SSL is not supported by the CF yet
// _connection.UseSSL          = false;
// _connection.UseStartTLS     = false;


Thank you for the information: I can't just count bytes in the socket callbacks.
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
If you are on WM5 you can, because CF supports no SSL.

Alex
Avatar
ayyrk #5
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
I don't get it yet -

I have "_connection.UseCompression = true;" doesn't that mean the xmpp traffic is sent compressed? If it is sent compressed then counting bytes in the socket callbacks would not give me an accurate count of bytes sent and received.

CF doesn't support SSL - OK - but can't it still use compression?

Thanks again
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by ayyrk:
I have "_connection.UseCompression = true;" doesn't that mean the xmpp traffic is sent compressed?

It is if compression is supported by the server and enabled on the server. Not all servers support compression.
The stream is not compressed from the beginning. When connecting and authenticating the server advertises the supported features. If one of them is compression agsXMPP tell the server to compress the stream. From this point the stream is compressed then.

Quote by ayyrk:
If it is sent compressed then counting bytes in the socket callbacks would not give me an accurate count of bytes sent and received.

yes this is correct.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS