By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,758 Members | 1,272 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,758 IT Pros & Developers. It's quick & easy.

Socket.IOControl and SIO_KEEPALIVE_VALS

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
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

Nov 16 '05 #2

P: n/a
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
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


Nov 16 '05 #3

P: n/a
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
> 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


Nov 16 '05 #4

P: n/a
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
> 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


Nov 16 '05 #5

P: n/a
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" <Mi*********@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
> 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 [.NET/C# MVP]" wrote:
>
>> 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]
>> - mv*@spam.guard.caspershouse.com
>>
>> "Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in
>> message
>> news:D5**********************************@microsof t.com...
>> > 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
>>
>>
>>


Nov 16 '05 #6

P: n/a
Thank you for you reply, it answered my question.

"Willy Denoyette [MVP]" wrote:
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" <Mi*********@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
> 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 [.NET/C# MVP]" wrote:
>
>> 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]
>> - mv*@spam.guard.caspershouse.com
>>
>> "Michel Hardy" <Mi*********@discussions.microsoft.com> wrote in
>> message
>> news:D5**********************************@microsof t.com...
>> > 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
>>
>>
>>


Nov 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.