LInet::GetQueueSize
#include "ltwrappr.h"
L_INT32 LInet::GetQueueSize(L_VOID)
Returns the size of the LEADTOOLS internal send queue.
Returns
>=0 |
If return value is between 1 and 0xFFFFFFFE, then it represents the number of bytes in the queue, not counting any LEADTOOLS headers. If 0 is returned, then there is no data in the queue. |
< 0 |
An error occurred. Refer to Return Codes. |
Comments
Only actual data will be counted. The LEADTOOLS' headers which pad the data are not counted.
If QUEUE_NO_DATA (0xFFFFFFFF) is returned, then there is no data, but the queue is not empty and consists only of LEADTOOLS' headers used for auto process.
NOTE: Even if the return value is 0, there is no guarantee that all bytes have been sent and you can do a hard close (i.e. LInet::Close(FALSE) ).
Winsock (which LEADTOOLS uses) has its own internal queue and we have no access to it. Therefore we have no way of knowing how much data has been sent.
You must initialize the LEADTOOLS Internet DLL using LInet::StartUp before calling this function.
Required DLLs and Libraries
LTNET For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
LInet::ClearQueue, LInet::SendData, LInet::SendBitmap, LInet::SendRawData, LInet::SendSound, LInet::StartUp, LInet::ShutDown, Class Members |
Example
// a user defined class from LInet should be used to support OnConnect callback function
// suppose it was named as LUserInet
LUserInet UserInet;
UserInet.StartUp();
// connect to LEAD.
UserInet.Connect("207.238.49.190", 1000);
// other operationsDat
UserInet.ShutDown();
L_INT LUserInet::OnConnect(LInet L_FAR *plConnection, L_INT nError)
{
static L_CHAR aData[50000] = "Some Data";
L_UINT32 ulDataSize;
L_INT nRet = SUCCESS;
if (nError != SUCCESS)
return nError;
ulDataSize = sizeof(aData);
nRet = SendData(plConnection, aData, &ulDataSize, IDATA_USER1);
ulDataSize = plConnection->GetQueueSize();
// abort the current send if less than 25k have been sent
if ( ulDataSize > 0 && ulDataSize < 25000)
plConnection->ClearQueue();
// other operations
// we can close the connection without data loss with a graceful connection.
//The closing will be trminated immediatlly
// and all the data will not be sent. remove the next line if you want to keep the connection open
Close(plConnection);
return nRet;
}