| 278 | } |
| 279 | |
| 280 | int Socket::Send( const void* _buf, int len ) |
| 281 | { |
| 282 | const auto sock = m_sock.load( std::memory_order_relaxed ); |
| 283 | auto buf = (const char*)_buf; |
| 284 | assert( sock != -1 ); |
| 285 | auto start = buf; |
| 286 | while( len > 0 ) |
| 287 | { |
| 288 | auto ret = send( sock, buf, len, MSG_NOSIGNAL ); |
| 289 | if( ret == -1 ) return -1; |
| 290 | len -= ret; |
| 291 | buf += ret; |
| 292 | } |
| 293 | return int( buf - start ); |
| 294 | } |
| 295 | |
| 296 | int Socket::GetSendBufSize() |
| 297 | { |