I wanted to send data via TCP using TDI_SEND. My problem is that
I have to close the “Socket” before the data I sent. Is is possible to
directly sent data when I used the TdiBuildSend???
I hope someone could help me!!!
Rob Schalken
I wanted to send data via TCP using TDI_SEND. My problem is that
I have to close the “Socket” before the data I sent. Is is possible to
directly sent data when I used the TdiBuildSend???
I hope someone could help me!!!
Rob Schalken
I don’t exactly understand you. You prepare IRP for sending, do
IoCallDriver, got STATUS_PENDING and directly after that you close file
object. Is it correct?
If it’s so what is your problem?
----- Original Message -----
From: “Schalken, Rob”
To: “NT Developers Interest List”
Sent: Wednesday, May 29, 2002 11:02 AM
Subject: [ntdev] TDI_SEND problems
> I wanted to send data via TCP using TDI_SEND. My problem is that
> I have to close the “Socket” before the data I sent. Is is possible to
> directly sent data when I used the TdiBuildSend???
>
> I hope someone could help me!!!
>
> Rob Schalken
>
>
>
Almost!!
I prepare IRP for sending do IoCallDriver.
Check if STATUS_PENDING and then the data is put into
a buffer but I want the tcp driver to send it directly!!!
And when I close my file object the data is send!
Another question: I use IoAllocateMdl & MmProbeAndLockPages but when
I
want to free & unlock these my pc craches! Any suggestions ?
This is my send function :
KeInitializeEvent( &Event, NotificationEvent, FALSE );
DeviceObject = IoGetRelatedDeviceObject( FileObject );
Irp = TdiBuildInternalDeviceControlIrp( TDI_SEND,
DeviceObject,
FileObject,
&Event,
&IoStatus );
if (Irp == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
}
if (NT_SUCCESS(Status))
{
Mdl = IoAllocateMdl( Data, Length, FALSE, FALSE, Irp );
if (Mdl == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
}
if (NT_SUCCESS(Status))
{
MmProbeAndLockPages( Mdl, KernelMode, IoModifyAccess );
TdiBuildSend( Irp,
DeviceObject,
FileObject,
NULL,
NULL,
Mdl,
0,
Length);
Status = IoCallDriver( DeviceObject, Irp );
if (Status == STATUS_PENDING)
{
Status = KeWaitForSingleObject( &Event, UserRequest, KernelMode,
FALSE, 0 );
}
//MmUnlockPages( Mdl );
//IoFreeMdl( Mdl );
}
}
return Status == STATUS_SUCCESS ? IoStatus.Status : Status;
}
-----Original Message-----
From: vlad-ntdev [mailto:xxxxx@unshadow.net]
Sent: Wednesday, May 29, 2002 9:20 AM
To: NT Developers Interest List
Subject: [ntdev] Re: TDI_SEND problems
I don’t exactly understand you. You prepare IRP for sending, do
IoCallDriver, got STATUS_PENDING and directly after that you close file
object. Is it correct?
If it’s so what is your problem?
----- Original Message -----
From: “Schalken, Rob”
To: “NT Developers Interest List”
Sent: Wednesday, May 29, 2002 11:02 AM
Subject: [ntdev] TDI_SEND problems
> I wanted to send data via TCP using TDI_SEND. My problem is that
> I have to close the “Socket” before the data I sent. Is is possible to
> directly sent data when I used the TdiBuildSend???
>
> I hope someone could help me!!!
>
> Rob Schalken
>
>
>
—
You are currently subscribed to ntdev as: xxxxx@emdes.nl
To unsubscribe send a blank email to %%email.unsub%%
> Almost!!
- I prepare IRP for sending do IoCallDriver.
Check if STATUS_PENDING and then the data is put into
a buffer but I want the tcp driver to send it directly!!!
And when I close my file object the data is send!
You’re talking about Nagle algorithm, aren’t you?
In sockets you should use setsockopt with TCP_NODELAY. Afd does
IRP_MJ_DEVICE_CONTROL for tcpip IOCTL_TCP_SET_INFORMATION_EX. I didn’t tried
it but I hope this information helps you.
#define IOCTL_TCP_SET_INFORMATION_EX \
_TCP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
enum {
TCP_SOCKET_NODELAY = 1,
TCP_SOCKET_KEEPALIVE = 2,
TCP_SOCKET_OOBINLINE = 3,
TCP_SOCKET_BSDURGENT = 4,
TCP_SOCKET_ATMARK = 5,
TCP_SOCKET_WINDOW = 6
};
- Another question: I use IoAllocateMdl & MmProbeAndLockPages but when
I
want to free & unlock these my pc craches! Any suggestions ?
Yes! You haven’t to do MmUnlockPages and IoFreeMdl because I/O Manager does
it for you.
vlad-ntdev
-----Original Message-----
From: vlad-ntdev [mailto:xxxxx@unshadow.net]
Sent: Wednesday, May 29, 2002 9:20 AM
To: NT Developers Interest List
Subject: [ntdev] Re: TDI_SEND problemsI don’t exactly understand you. You prepare IRP for sending, do
IoCallDriver, got STATUS_PENDING and directly after that you close file
object. Is it correct?If it’s so what is your problem?
----- Original Message -----
From: “Schalken, Rob”
> To: “NT Developers Interest List”
> Sent: Wednesday, May 29, 2002 11:02 AM
> Subject: [ntdev] TDI_SEND problems
>
>
> > I wanted to send data via TCP using TDI_SEND. My problem is that
> > I have to close the “Socket” before the data I sent. Is is possible to
> > directly sent data when I used the TdiBuildSend???
> >
> > I hope someone could help me!!!
> >
> > Rob Schalken
> >
> >
> >
I do not use sockets but TDI client!
Is there no other sollution, because setsockopt is not possible
when writing a driver. This IRP_MJ_DEVICE_CONTROL I must call from
User mode isn’t it? I want to change it in kernel mode!!
OK Thank You
-----Original Message-----
From: vlad-ntdev [mailto:xxxxx@unshadow.net]
Sent: Wednesday, May 29, 2002 10:03 AM
To: NT Developers Interest List
Subject: [ntdev] Re: TDI_SEND problems
Almost!!
- I prepare IRP for sending do IoCallDriver.
Check if STATUS_PENDING and then the data is put into
a buffer but I want the tcp driver to send it directly!!!
And when I close my file object the data is send!
You’re talking about Nagle algorithm, aren’t you?
In sockets you should use setsockopt with TCP_NODELAY. Afd does
IRP_MJ_DEVICE_CONTROL for tcpip IOCTL_TCP_SET_INFORMATION_EX. I didn’t tried
it but I hope this information helps you.
#define IOCTL_TCP_SET_INFORMATION_EX \
_TCP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
enum {
TCP_SOCKET_NODELAY = 1,
TCP_SOCKET_KEEPALIVE = 2,
TCP_SOCKET_OOBINLINE = 3,
TCP_SOCKET_BSDURGENT = 4,
TCP_SOCKET_ATMARK = 5,
TCP_SOCKET_WINDOW = 6
};
- Another question: I use IoAllocateMdl & MmProbeAndLockPages but when
I
want to free & unlock these my pc craches! Any suggestions ?
Yes! You haven’t to do MmUnlockPages and IoFreeMdl because I/O Manager does
it for you.
vlad-ntdev
-----Original Message-----
From: vlad-ntdev [mailto:xxxxx@unshadow.net]
Sent: Wednesday, May 29, 2002 9:20 AM
To: NT Developers Interest List
Subject: [ntdev] Re: TDI_SEND problemsI don’t exactly understand you. You prepare IRP for sending, do
IoCallDriver, got STATUS_PENDING and directly after that you close file
object. Is it correct?If it’s so what is your problem?
----- Original Message -----
From: “Schalken, Rob”
> To: “NT Developers Interest List”
> Sent: Wednesday, May 29, 2002 11:02 AM
> Subject: [ntdev] TDI_SEND problems
>
>
> > I wanted to send data via TCP using TDI_SEND. My problem is that
> > I have to close the “Socket” before the data I sent. Is is possible to
> > directly sent data when I used the TdiBuildSend???
> >
> > I hope someone could help me!!!
> >
> > Rob Schalken
> >
> >
> >
—
You are currently subscribed to ntdev as: xxxxx@emdes.nl
To unsubscribe send a blank email to %%email.unsub%%
> 1) I do not use sockets but TDI client!
Cool.
Is there no other sollution, because setsockopt is not possible
when writing a driver. This IRP_MJ_DEVICE_CONTROL I must call from
User mode isn’t it? I want to change it in kernel mode!!
I think you can use ioctl both from user and from kernel mode too. In case
of sockets this call is done by afd.sys driver in kernel mode. Satisfied?
vlad-ntdev
> I think you can use ioctl both from user and from kernel mode too. In case
of sockets this call is done by afd.sys driver in kernel mode.
Satisfied?
Yes , you can talk to afd.sys from kernel mode, providing you open endpoint
file objects on it. But to make a full socket interface this way you still
have to provide a serious ammount of wrapping code, providing you want
sockets compatible with
BSD 4.4 or Winsock2. not all socket semantics are provided by afd.sys, much
is in helper DLLs , and in the interface to afd driver, msafd.dll.
----- Original Message -----
From: “vlad-ntdev”
To: “NT Developers Interest List”
Sent: Wednesday, May 29, 2002 12:27 PM
Subject: [ntdev] Re: TDI_SEND problems
> > 1) I do not use sockets but TDI client!
>
> Cool.
>
> > Is there no other sollution, because setsockopt is not possible
> > when writing a driver. This IRP_MJ_DEVICE_CONTROL I must call from
> > User mode isn’t it? I want to change it in kernel mode!!
> >
>
> I think you can use ioctl both from user and from kernel mode too. In case
> of sockets this call is done by afd.sys driver in kernel mode.
Satisfied?
>
> vlad-ntdev
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>
> BSD 4.4 or Winsock2. not all socket semantics are provided by
afd.sys, much
is in helper DLLs , and in the interface to afd driver, msafd.dll.
Calling AFD bypassing wsock32 is a bad idea, look at lots of WPUxxx
functions, msafd.dll calls them for each AFD socket, and I have doubts
things will work fine without them.
Also I suspect AFD sends APCs to msafd.dll.
Max
> > Almost!!
> 1) I prepare IRP for sending do IoCallDriver.
> Check if STATUS_PENDING and then the data is put into
> a buffer but I want the tcp driver to send it directly!!!
> And when I close my file object the data is send!
>You’re talking about Nagle algorithm, aren’t you?
Nagle will not help here. TDI_SEND waits for all ACKs to arrive from
the other side.
This is because TCPIP does not do send buffering (AFD does it), and,
after TDI_SEND is complete, the buffer is no more known to TCP, so it
will not be able to run retransmits.
Max