Simple Solution to SL multicast authorization

Source: Internet
Author: User

 

For specific SL source multicast and any source multicast, you must obtain the authorization of port 9430 of the current domain before joining the group.

The request authorization message is called "Announcement", and the response message is called "Authorization ". 0 and 1 respectively.

 The formats of announcements and authentication messages are as follows:  Struct  Silverlightpolicymessage {  Byte [ 3 ] Header = "  Sl \ 0  "  ;  Byte Version = 1  ;  Byte Messagetype = {announcement:0 , Authorization: 1  };  Byte [ 4  ] Messageid;  Byte [ 2  ] Port;  Byte [ 2  ] Applicationoriginurilength;  Byte  Groupaddresslength;  Byte [Applicationoriginurilength] applicationoriginuri;  Byte  [Groupaddresslength] groupaddress ;}

If the application is confirmedProgramIf the source Uri has the right to join the requested multicast group, change the 5th bytes of the Message Type to 1, indicating that the message can be authorized as the response data:

BelowCodeTest passed:

  Static Udpclient client = Null  ;  Static   Void Main ( String  [] ARGs) {Client = New Udpclient ( 9430 ); //  When the SL client requests authorization, the authorization is verified to port 9430. Client. beginreceive (receivecallback, Null  ); Console. Read ();}  Static   Void  Effececallback (iasyncresult result) {ipendpoint remoteep = Null  ;  Byte [] Announcement = client. endreceive (result, Ref Remoteep ); //  Receive announcement              If  (Result. iscompleted) {console. writeline (remoteep. Address. tostring () + "  :  " + Remoteep. Port); Announcement [  4 ] = 1 ; //  5th bytes 0 indicates announcement, 1 indicates authorization. The other data remains unchanged, and the message is changed to authorization as a response Client. beginsend (Announcement, announcement. length, remoteep, sendcallback, Null  ); Console. writeline (  "  Done  "  );}}  Static   Void  Sendcallback (iasyncresult asyncresult) {client. endsend (asyncresult );  If  (Asyncresult. iscompleted) {console. writeline (  " Sended  "  );}} 

After such processing, debugging of Multicast Applications becomes easier.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.