阅读:2504回复:1
tdi如何关闭Nagle算法
为啥关闭Nagle算法的代码不起作用呢?,是哪个地方的参数设置不对吗?
代码片段如下: ULONG option =1; pDevice = IoGetRelatedDeviceObject(pConnFileObject); pSetInformation = (PTCP_REQUEST_SET_INFORMATION_EX) ExAllocatePoolWithTag(NonPagedPool, sizeof(TCP_REQUEST_SET_INFORMATION_EX) + sizeof(ULONG),'IDT'); RtlZeroMemory (pSetInformation, sizeof(TCP_REQUEST_SET_INFORMATION_EX) + ulValueLength); pSetInformation->ID.toi_id = TCP_SOCKET_NODELAY; pSetInformation->ID.toi_type = INFO_TYPE_CONNECTION; pSetInformation->ID.toi_class = INFO_CLASS_PROTOCOL; pSetInformation->ID.toi_entity.tei_entity = CO_TL_ENTITY pSetInformation->ID.toi_entity.tei_instance = 0; memcpy(pSetInformation->Buffer,&option,sizeof(ULONG); pSetInformation->BufferSize = sizeof(ULONG); pIrp = IoAllocateIrp( (CCHAR)(pDevice->StackSize +1) , FALSE ); /* pIrp = IoBuildDeviceIoControlRequest(IOCTL_TCP_SET_INFORMATION_EX, pDevice,(PVOID)pSetInformation,sizeof(TCP_REQUEST_SET_INFORMATION_EX) + sizeof(ULONG) NULL,0,FALSE,NULL,NULL); */ if (!pIrp) { ExFreePool(pSetInformation); return STATUS_INSUFFICIENT_RESOURCES; } pIrpSp =IoGetNextIrpStackLocation(pIrp); pIrpSp->MajorFunction = IRP_MJ_DEVICE_CONTROL; pIrpSp->Parameters.DeviceIoControl.InputBufferLength = sizeof(TCP_REQUEST_SET_INFORMATION_EX) + sizeof(ULONG); pIrpSp->Parameters.DeviceIoControl.IoControlCode = IOCTL_TCP_SET_INFORMATION_EX; pIrp->AssociatedIrp.SystemBuffer = pSetInformation; pIrpSp->Parameters.DeviceIoControl.OutputBufferLength = 0; pIrpSp->DeviceObject = pDevice; pIrpSp->FileObject = pConnFileObject; IoSetCompletionRoutine(pIrp, OnQueryInfoComplete,pSetInformation,TRUE,TRUE,TRUE); Status = IoCallDriver(pDevice, pIrp); Status返回成功,可是实际上并没能关闭Nagle算法 恳求哪位大牛指点一下。 |
|
沙发#
发布于:2010-01-20 13:27
在tdi层跟踪以下setsockopt + IPPROTO_TCP+TCP_NODELAY
|
|
|