Skip to content
Snippets Groups Projects
Commit 01215dc2 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

keep track of recv/send bytes

parent 5466de7b
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment