I was wondering if someone could give me an example of how to correctly use
the MulticastInterface with sock.SetSocketOption(). I found it listed in
the enums for the socket options
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpref/html/frlrfsystemnetsocketssocketoptionnameclasstopic.asp
and it sounded like what I needed. I have 2 nics and I want to multicast
only on the one connected to that specific network.
Thanks,
Tom

RE: Using MulticastInterface SocketOption by v-phuang

v-phuang
Mon Oct 18 02:37:37 CDT 2004

Hi Tom,

Here is a KB article, you may take a look to see if that is what you want.
HOW TO: Use SetSocketOption() with MulticastInterface OptionName in Visual
Studio .NET (318911)
http://support.microsoft.com/default.aspx?scid=KB;EN-US;318911

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


RE: Using MulticastInterface SocketOption by Tom

Tom
Mon Oct 18 09:08:45 CDT 2004

v-phuang@online.microsoft.com ("Peter Huang") wrote in
news:BBRJeVOtEHA.724@cpmsftngxa06.phx.gbl:

> Hi Tom,
>
> Here is a KB article, you may take a look to see if that is what you
> want. HOW TO: Use SetSocketOption() with MulticastInterface OptionName
> in Visual Studio .NET (318911)
> http://support.microsoft.com/default.aspx?scid=KB;EN-US;318911
>
> Best regards,
>
> Peter Huang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>


That's not much of an excuse....it doesn't tell us what the argument is, it
just gets what someone types from the command prompt.

I have however found that this works:

setupSocket(IPAddress localIP, IPAddress mcIP, int port)
{
mcEP = new IPEndPoint(mcIP, port);
MulticastOption mcastOption = new MulticastOption(mcIP, localIP);
sock.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.AddMemebership, mcastOption);
sock.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.MulticastInterface, (int)localIP.Address);
}

It's that (int)locapIP.Address that was key to figuring this out. I don't
know if its possible, but someone might update that KB article to include
something like this...so we know what it is that's needed.
Thanks,
Tom


RE: Using MulticastInterface SocketOption by v-phuang

v-phuang
Tue Oct 19 00:24:41 CDT 2004

Hi,

I am sorry that I have somewhat confusion with your question.
But I am glat that you have found the solution yourself.
If you still have any concern on this issue, please feel free to post here
and we will follow up with you.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


RE: Using MulticastInterface SocketOption by Peter

Peter
Wed Nov 03 06:09:46 CST 2004

I have the same problem as Tom except I can't use the
IPAddress.Address method he recommended since that is an
obsolete method in .net Framwork 1.1.

Is there another way to use the MulticastInterface
SocketOption. It would be best if I could specifiy my
local IP address instead of an integer as the value for
MulticastInterface (The same way that it is done for
Addmembership).

/Peter


>-----Original Message-----
>v-phuang@online.microsoft.com ("Peter Huang") wrote in
>news:BBRJeVOtEHA.724@cpmsftngxa06.phx.gbl:
>
>> Hi Tom,
>>
>> Here is a KB article, you may take a look to see if
that is what you
>> want. HOW TO: Use SetSocketOption() with
MulticastInterface OptionName
>> in Visual Studio .NET (318911)
>> http://support.microsoft.com/default.aspx?scid=KB;EN-
US;318911
>>
>> Best regards,
>>
>> Peter Huang
>> Microsoft Online Partner Support
>>
>> Get Secure! - www.microsoft.com/security
>> This posting is provided "AS IS" with no warranties,
and confers no
>> rights.
>>
>>
>
>
>That's not much of an excuse....it doesn't tell us what
the argument is, it
>just gets what someone types from the command prompt.
>
>I have however found that this works:
>
>setupSocket(IPAddress localIP, IPAddress mcIP, int port)
>{
> mcEP = new IPEndPoint(mcIP, port);
> MulticastOption mcastOption = new MulticastOption
(mcIP, localIP);
> sock.SetSocketOption(SocketOptionLevel.IP,
>SocketOptionName.AddMemebership, mcastOption);
> sock.SetSocketOption(SocketOptionLevel.IP,
>SocketOptionName.MulticastInterface, (int)
localIP.Address);
>}
>
>It's that (int)locapIP.Address that was key to figuring
this out. I don't
>know if its possible, but someone might update that KB
article to include
>something like this...so we know what it is that's
needed.
>Thanks,
>Tom
>
>.
>

RE: Using MulticastInterface SocketOption by anonymous

anonymous
Wed Nov 03 06:11:39 CST 2004

Hi Tom!
I have the same problem as you except I can't use the
IPAddress.Address method you recommend since that is an
obsolete method in .net Framwork 1.1.

Have you found another way to solve this?

/Peter

>-----Original Message-----
>v-phuang@online.microsoft.com ("Peter Huang") wrote in
>news:BBRJeVOtEHA.724@cpmsftngxa06.phx.gbl:
>
>> Hi Tom,
>>
>> Here is a KB article, you may take a look to see if
that is what you
>> want. HOW TO: Use SetSocketOption() with
MulticastInterface OptionName
>> in Visual Studio .NET (318911)
>> http://support.microsoft.com/default.aspx?scid=KB;EN-
US;318911
>>
>> Best regards,
>>
>> Peter Huang
>> Microsoft Online Partner Support
>>
>> Get Secure! - www.microsoft.com/security
>> This posting is provided "AS IS" with no warranties,
and confers no
>> rights.
>>
>>
>
>
>That's not much of an excuse....it doesn't tell us what
the argument is, it
>just gets what someone types from the command prompt.
>
>I have however found that this works:
>
>setupSocket(IPAddress localIP, IPAddress mcIP, int port)
>{
> mcEP = new IPEndPoint(mcIP, port);
> MulticastOption mcastOption = new MulticastOption
(mcIP, localIP);
> sock.SetSocketOption(SocketOptionLevel.IP,
>SocketOptionName.AddMemebership, mcastOption);
> sock.SetSocketOption(SocketOptionLevel.IP,
>SocketOptionName.MulticastInterface, (int)
localIP.Address);
>}
>
>It's that (int)locapIP.Address that was key to figuring
this out. I don't
>know if its possible, but someone might update that KB
article to include
>something like this...so we know what it is that's
needed.
>Thanks,
>Tom
>
>.
>

RE: Using MulticastInterface SocketOption by Peter

Peter
Wed Nov 03 06:20:30 CST 2004

I have the same problem as Tom except I can't use the
IPAddress.Address method he recommended since that is an
obsolete method in .net Framwork 1.1.

Is there another way to use the MulticastInterface
SocketOption. It would be best if I could specifiy my
local IP address instead of an integer as the value for
MulticastInterface (The same way that it is done for
Addmembership).

/Peter

>-----Original Message-----
>Hi,
>
>I am sorry that I have somewhat confusion with your
question.
>But I am glat that you have found the solution yourself.
>If you still have any concern on this issue, please feel
free to post here
>and we will follow up with you.
>
>
>Best regards,
>
>Peter Huang
>Microsoft Online Partner Support
>
>Get Secure! - www.microsoft.com/security
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>
>.
>

Re: Using MulticastInterface SocketOption by Robert

Robert
Wed Nov 03 08:08:00 CST 2004

Hi Peter,

> I have the same problem as Tom except I can't use the
> IPAddress.Address method he recommended since that is an
> obsolete method in .net Framwork 1.1.
>
> Is there another way to use the MulticastInterface
> SocketOption. It would be best if I could specifiy my
> local IP address instead of an integer as the value for
> MulticastInterface (The same way that it is done for
> Addmembership).

This is the non-obsolet a.Address equivalent:

BitConverter.ToInt32(a.GetAddressBytes(), 0);

It only works for IPv4.

bye
Rob

Re: Using MulticastInterface SocketOption by Tom

Tom
Fri Nov 05 10:48:04 CST 2004

Robert Jordan <robertj@gmx.net> wrote in news:cmaoo2$d91$05$1@news.t-
online.com:

> Hi Peter,
>
>> I have the same problem as Tom except I can't use the
>> IPAddress.Address method he recommended since that is an
>> obsolete method in .net Framwork 1.1.
>>
>> Is there another way to use the MulticastInterface
>> SocketOption. It would be best if I could specifiy my
>> local IP address instead of an integer as the value for
>> MulticastInterface (The same way that it is done for
>> Addmembership).
>
> This is the non-obsolet a.Address equivalent:
>
> BitConverter.ToInt32(a.GetAddressBytes(), 0);
>
> It only works for IPv4.
>
> bye
> Rob
>

That would work...i found that the a.Address does work, even being
obsolete.

Anyway, i've got all my stuff working :-)