Socket.IOControl and SIO_KEEPALIVE_VALS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, does anyone know how to use the Socket.IOControl method to set the
keep alive message?

I already have the SIO_KEEPALIVE_VALS value and structure, but how do I pass
it to the IOControl method?

Thanks
 
Michel,

It looks like for SIO_KEEPALIVE_VALS, you have to send a structure of
three unsigned longs. You can just pass in an array of 12 bytes, if you
want, and handle the value yourself.

Also, you can send the value IOControl.KeepAliveValues instead of
defining SIO_KEEPALIVE_VALS yourself.

Hope this helps.
 
Thanks for your answer Nicholas.

I need a little more help here, if I'm not mistaken ulong is 8 bytes (64
bits) wouldn't it be an array of 24 bytes?

And also I have not been able to find a reference for
IOControl.KeepAliveValues in either the Net or Socket namespace, can you tell
me where I can find it?

Thanks.

Nicholas Paldino said:
Michel,

It looks like for SIO_KEEPALIVE_VALS, you have to send a structure of
three unsigned longs. You can just pass in an array of 12 bytes, if you
want, and handle the value yourself.

Also, you can send the value IOControl.KeepAliveValues instead of
defining SIO_KEEPALIVE_VALS yourself.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Michel Hardy said:
Hello, does anyone know how to use the Socket.IOControl method to set the
keep alive message?

I already have the SIO_KEEPALIVE_VALS value and structure, but how do I
pass
it to the IOControl method?

Thanks
 
Michel,

A ulong in .NET is 8 bytes, but in C (from which the structure
definition comes from) a ulong is 4 bytes.

I made a mistake, you want to find the IOControlCode enumeration. You
can find it in the System.Net.Sockets namespace.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Michel Hardy said:
Thanks for your answer Nicholas.

I need a little more help here, if I'm not mistaken ulong is 8 bytes (64
bits) wouldn't it be an array of 24 bytes?

And also I have not been able to find a reference for
IOControl.KeepAliveValues in either the Net or Socket namespace, can you
tell
me where I can find it?

Thanks.

Nicholas Paldino said:
Michel,

It looks like for SIO_KEEPALIVE_VALS, you have to send a structure of
three unsigned longs. You can just pass in an array of 12 bytes, if you
want, and handle the value yourself.

Also, you can send the value IOControl.KeepAliveValues instead of
defining SIO_KEEPALIVE_VALS yourself.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Michel Hardy said:
Hello, does anyone know how to use the Socket.IOControl method to set
the
keep alive message?

I already have the SIO_KEEPALIVE_VALS value and structure, but how do I
pass
it to the IOControl method?

Thanks
 
Thank you for clarifying the bytes issue.

The only problem I have is I still can't find that IOControlCode enumeration
in the System.Net.Sockets. I even tried to search for it with the object
browser and I still can't find it. I'm using Visual Studio 2003 with the
framework 1.1.

I have found the value for SIO_KEEPALIVE_VALS which equals to 2,550,136,836
the only problem, it as to be an unsigned int because it's greater than an
int and the IOControl method takes a int as IOControlCode. Things would be
simpler if I could find that enumeration...

Any idea why I don't see it?

Thanks

Nicholas Paldino said:
Michel,

A ulong in .NET is 8 bytes, but in C (from which the structure
definition comes from) a ulong is 4 bytes.

I made a mistake, you want to find the IOControlCode enumeration. You
can find it in the System.Net.Sockets namespace.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Michel Hardy said:
Thanks for your answer Nicholas.

I need a little more help here, if I'm not mistaken ulong is 8 bytes (64
bits) wouldn't it be an array of 24 bytes?

And also I have not been able to find a reference for
IOControl.KeepAliveValues in either the Net or Socket namespace, can you
tell
me where I can find it?

Thanks.

Nicholas Paldino said:
Michel,

It looks like for SIO_KEEPALIVE_VALS, you have to send a structure of
three unsigned longs. You can just pass in an array of 12 bytes, if you
want, and handle the value yourself.

Also, you can send the value IOControl.KeepAliveValues instead of
defining SIO_KEEPALIVE_VALS yourself.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello, does anyone know how to use the Socket.IOControl method to set
the
keep alive message?

I already have the SIO_KEEPALIVE_VALS value and structure, but how do I
pass
it to the IOControl method?

Thanks
 
There is no such enum in v1.1.
This has been added in v2.0.

For now you have to define the codes yourself from the platform sdk header
files.
The control code for SIO_KEEPALIVE_VALS is:

-1744830460 (or 0x98000004)

Willy.


Michel Hardy said:
Thank you for clarifying the bytes issue.

The only problem I have is I still can't find that IOControlCode
enumeration
in the System.Net.Sockets. I even tried to search for it with the object
browser and I still can't find it. I'm using Visual Studio 2003 with the
framework 1.1.

I have found the value for SIO_KEEPALIVE_VALS which equals to
2,550,136,836
the only problem, it as to be an unsigned int because it's greater than an
int and the IOControl method takes a int as IOControlCode. Things would be
simpler if I could find that enumeration...

Any idea why I don't see it?

Thanks

Nicholas Paldino said:
Michel,

A ulong in .NET is 8 bytes, but in C (from which the structure
definition comes from) a ulong is 4 bytes.

I made a mistake, you want to find the IOControlCode enumeration.
You
can find it in the System.Net.Sockets namespace.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Michel Hardy said:
Thanks for your answer Nicholas.

I need a little more help here, if I'm not mistaken ulong is 8 bytes
(64
bits) wouldn't it be an array of 24 bytes?

And also I have not been able to find a reference for
IOControl.KeepAliveValues in either the Net or Socket namespace, can
you
tell
me where I can find it?

Thanks.

:

Michel,

It looks like for SIO_KEEPALIVE_VALS, you have to send a structure
of
three unsigned longs. You can just pass in an array of 12 bytes, if
you
want, and handle the value yourself.

Also, you can send the value IOControl.KeepAliveValues instead of
defining SIO_KEEPALIVE_VALS yourself.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

message
Hello, does anyone know how to use the Socket.IOControl method to
set
the
keep alive message?

I already have the SIO_KEEPALIVE_VALS value and structure, but how
do I
pass
it to the IOControl method?

Thanks
 
Thank you for you reply, it answered my question.

Willy Denoyette said:
There is no such enum in v1.1.
This has been added in v2.0.

For now you have to define the codes yourself from the platform sdk header
files.
The control code for SIO_KEEPALIVE_VALS is:

-1744830460 (or 0x98000004)

Willy.


Michel Hardy said:
Thank you for clarifying the bytes issue.

The only problem I have is I still can't find that IOControlCode
enumeration
in the System.Net.Sockets. I even tried to search for it with the object
browser and I still can't find it. I'm using Visual Studio 2003 with the
framework 1.1.

I have found the value for SIO_KEEPALIVE_VALS which equals to
2,550,136,836
the only problem, it as to be an unsigned int because it's greater than an
int and the IOControl method takes a int as IOControlCode. Things would be
simpler if I could find that enumeration...

Any idea why I don't see it?

Thanks

Nicholas Paldino said:
Michel,

A ulong in .NET is 8 bytes, but in C (from which the structure
definition comes from) a ulong is 4 bytes.

I made a mistake, you want to find the IOControlCode enumeration.
You
can find it in the System.Net.Sockets namespace.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Thanks for your answer Nicholas.

I need a little more help here, if I'm not mistaken ulong is 8 bytes
(64
bits) wouldn't it be an array of 24 bytes?

And also I have not been able to find a reference for
IOControl.KeepAliveValues in either the Net or Socket namespace, can
you
tell
me where I can find it?

Thanks.

:

Michel,

It looks like for SIO_KEEPALIVE_VALS, you have to send a structure
of
three unsigned longs. You can just pass in an array of 12 bytes, if
you
want, and handle the value yourself.

Also, you can send the value IOControl.KeepAliveValues instead of
defining SIO_KEEPALIVE_VALS yourself.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

message
Hello, does anyone know how to use the Socket.IOControl method to
set
the
keep alive message?

I already have the SIO_KEEPALIVE_VALS value and structure, but how
do I
pass
it to the IOControl method?

Thanks
 
Back
Top