Definition at line 568 of file Channel.h. References CTR_HEADER_SIZE, HandleError(), ILOG_DEBUG, and mBuffer. Referenced by SendRequest(), and Serve(). 00569 { 00570 int rval; 00571 ILOG_DEBUG("sending " << nrData << " data bytes"); 00572 00573 // assemble CTR header to tell receiver the number of bytes to expect 00574 int nrToSend = nrData + CTR_HEADER_SIZE; 00575 sprintf(mBuffer, "CTR %d\0", nrToSend); 00576 ILOG_DEBUG("send : CTR buf [" << mBuffer << "]"); 00577 00578 // now send the buffer 00579 int nrSend = 0; 00580 char* bufPtr = mBuffer; 00581 do 00582 { 00583 rval = send(sock, bufPtr, nrToSend - nrSend, 0); 00584 if (rval == SOCKET_ERROR) 00585 { 00586 HandleError("SendLarge", true); 00587 return -1; 00588 } 00589 ILOG_DEBUG("sent " << rval << " bytes"); 00590 bufPtr += rval; 00591 nrSend += rval; 00592 } 00593 while (nrSend < nrToSend); 00594 if (nrSend != nrToSend) 00595 { 00596 HandleError("sent incorrect number of bytes!", true); 00597 return -1; 00598 } 00599 return nrSend; 00600 }
Here is the call graph for this function: ![]()
|