TdiBuildReceive

hi all,
i am trying to receive data using TdiBuildReceive api, the buffer 10 kb provided in this api contains only 1 kb of data , i am expecting the large full 10 kb data.
i checked with wire shark that data is fully coming to the machine but api is unable to capture.

portion of code is as follows.

PMDL ReceiveBufferMdl = IoAllocateMdl(ReceiveBuffer, ReceiveBufferLength, FALSE, FALSE, NULL);
if(ReceiveBufferMdl)
{
//Flag, set if the page was blocked
unsigned_native_int PagesIsLocked = false;
//We are trying to lock pages in physical memory
__try{
MmProbeAndLockPages(ReceiveBufferMdl, KernelMode, IoWriteAccess);
PagesIsLocked = true;
}
__except(EXCEPTION_EXECUTE_HANDLER){
//A function call fails
ThisFunctionResult = STATUS_UNSUCCESSFUL;
}
//If the page has block
if(PagesIsLocked){
//Set the end of the list of MDL
ReceiveBufferMdl->Next = NULL;
//Timeout end processing IRP, in milliseconds
unsigned_native_int IRPCompletionWaitInterval = 20 * 60 * 1000;//20 minutes
/* Implementation based on the interface TDI */
#if defined(BUILD_KERNEL_SOCKETS_ON_TDI)
//Forming IRP - TDI_RECEIVE
TdiBuildReceive(Socket->Irp, Socket->TransportDeviceObject, Socket->ConnectionEndPointFile.Object, IRPCompletionRoutine, Socket, ReceiveBufferMdl, TDI_RECEIVE_NORMAL, ReceiveBufferLength);

//Call the function of the transport driver
ThisFunctionResult = IoCallDriver(Socket->TransportDeviceObject, Socket->Irp);

//If the IRP queued
if(ThisFunctionResult == STATUS_PENDING){
//Expect to process IRP
ThisFunctionResult = WaitForIRPCompletion(Socket, IRPCompletionWaitInterval);
}

Are you saying that you allocate a 10K buffer, submit a TDI_RECEIVE with
that buffer, and get 1K of data returned? And that you really want TCP to
wait until 10K is available instead?

I think TCP is going to give you all the data it has or the first data
(segment) it gets. In this case, a ~1K segment. You need to issue
additional reads and accumulate the 10k.

BTW, have you considered using TDI Event callbacks on the address object
instead of TDI_RECEIVE IRPs? Most kernel TDI clients take that approach
and avoid having to run all of the I/O machinery if the data source and/or
sink is not ultimately in usermode.

Good Luck,
Dave Cattley