×
Namespaces

Variants
Actions

Archived:Joining and leaving a multicast stream

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): Nokia E61, Nokia N78, Nokia E66, Nokia N95
Compatibility
Platform(s): S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Keywords: KSoIp6MulticastLoop, KSoIp6MulticastHops
Created: User:Technical writer 1 (12 May 2009)
Last edited: hamishwillee (15 Jun 2012)


Description

Multicast addressing is a network technology for delivering information to a group of destinations simultaneously using the most efficient strategy to deliver the messages over each link of the network only once, creating copies only when the links to the multiple destinations split.

Nokia devices can receive multicast streams by connecting to the network of the streaming PC through WLAN and sending a join message to the multicast group address. Once a phone joins the multicast stream, the streaming packets can be received on the local port provided along with the multicast address.

Solution

Joining a multicast stream:

  User::LeaveIfError(iSocketServ.Connect());			  
RConnection connection;
User::LeaveIfError( connection.Open( iSession, KConnectionTypeDefault ) );
User::LeaveIfError( connection.Start() );
User::LeaveIfError(iSocket.Open(iSession, KAfInet, KSockDatagram, KProtocolInetUdp, connection));<br>
User::LeaveIfError(iSocket.SetLocalPort(59846)); //Port where the streaming packets will be received
iSocket.SetOpt( KSoIp6MulticastLoop, KProtocolInetIp, 0);
iSocket.SetOpt(KSoIp6MulticastHops, KSolInetIp,4);
iSocket.SetOpt( KSoReuseAddr, KProtocolInetIp, 1 )<br>
TInetAddr multicastaddr;
multicastaddr.SetAddress(INET_ADDR(228,19,126,221)); //Multicast Group Address
multicastaddr.SetFamily(KAfInet);
multicastaddr.ConvertToV4Mapped();
TIp6Mreq mreq;
mreq.iAddr = multicastaddr.Ip6Address();
mreq.iInterface = 0;
TPckgBuf< TIp6Mreq > opt( mreq );
User::LeaveIfError(iSocket.SetOpt(KSoIp6JoinGroup, KSolInetIp, opt ));

Leaving a multicast stream:

  TInetAddr multicastaddr;
multicastaddr.SetAddress(INET_ADDR(228,19,126,221));
multicastaddr.SetFamily(KAfInet);
multicastaddr.ConvertToV4Mapped();
TIp6Mreq mreq;
mreq.iAddr = multicastaddr.Ip6Address();<br>
mreq.iInterface = 0;
TPckgBuf< TIp6Mreq > opt( mreq );
User::LeaveIfError(iSocket.SetOpt(KSoIp6LeaveGroup, KSolInetIp, opt ));

Note: A multicast stream can be set up using the LiveCaster application available here: LiveCaster

This page was last modified on 15 June 2012, at 03:48.
44 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×