diff --git a/Common/GmshSocket.h b/Common/GmshSocket.h index 1f19ae5f1fb21579bf34a2771fb76189bc2b2a39..e4dc1c540d45dd7f3fed295db60cd01ca0a0ab87 100644 --- a/Common/GmshSocket.h +++ b/Common/GmshSocket.h @@ -98,6 +98,8 @@ class GmshSocket{ int _sock; // the socket name std::string _sockname; + // statistics + unsigned long int _sent, _received; // send some data over the socket int _SendData(const void *buffer, int bytes) { @@ -110,6 +112,7 @@ class GmshSocket{ sofar += len; remaining -= len; } while(remaining > 0); + _sent += bytes; return bytes; } // receive some data over the socket @@ -125,6 +128,7 @@ class GmshSocket{ sofar += len; remaining -= len; } while(remaining > 0); + _received += bytes; return bytes; } // utility function to swap bytes in an array @@ -149,7 +153,7 @@ class GmshSocket{ #endif } public: - GmshSocket() : _sock(0) + GmshSocket() : _sock(0), _sent(0), _received(0) { #if defined(WIN32) && !defined(__CYGWIN__) WSADATA wsaData; @@ -250,6 +254,8 @@ class GmshSocket{ shutdown(s, SHUT_RDWR); #endif } + unsigned long int SentBytes(){ return _sent; } + unsigned long int ReceivedBytes(){ return _received; } }; class GmshClient : public GmshSocket {