1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Allow retrieval of socket send buffer size.

This commit is contained in:
Bartosz Taudul 2019-04-01 18:50:37 +02:00
parent 45750a05a1
commit 57cd6d3ed5
2 changed files with 13 additions and 0 deletions

View File

@ -149,6 +149,18 @@ int Socket::Send( const void* _buf, int len )
return int( buf - start ); return int( buf - start );
} }
int Socket::GetSendBufSize()
{
int bufSize;
int sz = sizeof( bufSize );
#if defined _WIN32 || defined __CYGWIN__
getsockopt( m_sock, SOL_SOCKET, SO_SNDBUF, (char*)&bufSize, &sz );
#else
getsockopt( m_sock, SOL_SOCKET, SO_SNDBUF, &bufSize, &sz );
#endif
return bufSize;
}
int Socket::RecvBuffered( void* buf, int len, int timeout ) int Socket::RecvBuffered( void* buf, int len, int timeout )
{ {
if( len <= m_bufLeft ) if( len <= m_bufLeft )

View File

@ -23,6 +23,7 @@ public:
void Close(); void Close();
int Send( const void* buf, int len ); int Send( const void* buf, int len );
int GetSendBufSize();
bool Read( void* buf, int len, int timeout, std::function<bool()> exitCb ); bool Read( void* buf, int len, int timeout, std::function<bool()> exitCb );
bool ReadRaw( void* buf, int len, int timeout ); bool ReadRaw( void* buf, int len, int timeout );