Multicast socket

0 views
Skip to first unread message

Jim H

unread,
Apr 13, 2004, 11:06:58 PM4/13/04
to
Is there something special I need to do to send data to a multicast IP and
have it go across a router? Router is a Win2000 Server connecting 2
networks via RRAS PPTP. The routing appears to be working because I can
ping the multicast address and get responses from the server on the other
network. I didn't think ping would work like that but as long as I have the
server process running I can ping the multicast IP and get a response. The
problem is my client app's packets do not appear to be reaching my server.
Is there something special I need to do to the client socket? I tried
SetSocketOption and adding it to the multicast group but that didn't help
either. It could be rras but ping worked. The SendTo executed without
error and sent the data out.

Thanks,
jim


Jeffrey Tan[MSFT]

unread,
Apr 14, 2004, 4:44:11 AM4/14/04
to
Hi Jim,

Based on my understanding, your Server application can not receive the
Client's data.

I think you should first determine if the problem is due to your router. To
determine this, you may test your CS application on 2 machines which there
is no router between them.

Also, you may use the Network Monitor with your router, your server
machine, your client machine to analysis which network segment lost the
sending data.

For more information about how to do multicast, please refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemnetsocketsmulticastoptionclasstopic.asp

The below article teaches you how to use UDP client to listen for UDP
datagrams broadcast to the multicast address:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconusingudpservices.asp

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jim H

unread,
Apr 14, 2004, 11:08:07 AM4/14/04
to
I'm going to try and run it on the other network. I think it might be the
routing as well, but pings to the multicast address work and route.

I started a cs multicast server on this network and it connected fine, but
the listener was actually running in the same process so I'm not sure if
that was a valid enough test.

Thanks again,
jim

""Jeffrey Tan[MSFT]"" <v-j...@online.microsoft.com> wrote in message
news:ir4o7yfI...@cpmsftngxa06.phx.gbl...

Jeffrey Tan[MSFT]

unread,
Apr 15, 2004, 4:39:39 AM4/15/04
to
Hi Jim,

Thanks for your feedback.

Yes, because your ping works well, I think your network should be well. But
because your CS program does not work well, the datagram must be lost in
certain network section.

You may use Network Monitor tool to find which section you lost the
datagram. Thanks

Jim H

unread,
Apr 16, 2004, 1:32:28 PM4/16/04
to
FYI. The reason the packet never reached the other machine was not a
routing issue. The default TTL for a multicast packet is 1. This keeps the
packets on the current subnet because they will be dropped by the router.
The following function fixed the problem. Settting the MulticastTimeToLive
is neccessary for multicast packets to travel across subnets.

lSocket.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.MulticastTimeToLive, 5);

I still have another issue but will ask it in a separate post.

jim

""Jeffrey Tan[MSFT]"" <v-j...@online.microsoft.com> wrote in message

news:DyRvsUsI...@cpmsftngxa06.phx.gbl...

Jeffrey Tan[MSFT]

unread,
Apr 18, 2004, 9:24:36 PM4/18/04
to
Hi Jim,

Thanks very much for your feedback!

I am so glad you find the cause yourself, you should be proud of yourself.

Also, thanks for sharing your answer with the community!

For your another issue, is it titled "How do I cancel a BeginReceiveFrom" ?
I have replied you in that issue, please follow up there. Thanks.

Jim H

unread,
Apr 18, 2004, 11:37:03 PM4/18/04
to
My pleasure. MS might want to mention the multicast ttl in the multicast
section or maybe even set it int he example code. It's just another couple
lines of code and it might bring it to the attention of a programmer while
looking at the example.

Thanks,
jim

""Jeffrey Tan[MSFT]"" <v-j...@online.microsoft.com> wrote in message

news:R3MSc0aJ...@cpmsftngxa10.phx.gbl...

Jeffrey Tan[MSFT]

unread,
Apr 19, 2004, 1:34:53 AM4/19/04
to
Hi Jim,

Thanks very much for your feedback.

Actually, the lack mention of TTL setting for multicasting in MSDN is
because this is a need of IP Multicasting with multi-routers, it is related
to the RFC specification.

Please refer to this article:
"IP Multicasting in C#"
http://www.codeproject.com/csharp/multicast.asp

In the article, the author refers a RFC:
http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc1112.html

Which has 3 recommandations:
1. Join a multicast group
2. Leave a multicast group
3. Set the TTL of a multicast group

Also, the author mentioned:
"Sets the time to live for the socket - this is very important in defining
scope for the multicast data. Setting a value of 1 will mean the multicast
data will not leave the local network, setting it to anything above this
will allow the multicast data to pass through several routers, with each
router decrementing the TTL by 1. Getting the TTL value right is important
for bandwidth considerations."

So, I think the RFC specification has pointed out this, MSDN
SetSocketOption method is a general way to set a lot of Socket options, it
will refer such detail things.

Hope my reply makes sense to you.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,

Reply all
Reply to author
Forward
0 new messages