[Libwebsockets] 回复: [Question] Does libwebsockets support sending and receiving multicast packets?

谭小俊(Xiaojun Tan) tanxiaojun at oppo.com
Wed Jun 24 05:42:30 CEST 2020


Hi, Andy,

Thank you for your reply. Thanks a lot.

Where can I get the patch(the generic lws mDNS client / server patch) you mentioned.

Thanks.
Xiaojun.

-----邮件原件-----
发件人: andy at warmcat.com <andy at warmcat.com> 
发送时间: 2020年6月24日 11:33
收件人: libwebsockets at ml.libwebsockets.org; 谭小俊(Xiaojun Tan) <tanxiaojun at oppo.com>; libwebsockets at ml.libwebsockets.org
抄送: 胡岳伟(Wei) <huyuewei at oppo.com>
主题: Re: [Libwebsockets] [Question] Does libwebsockets support sending and receiving multicast packets?



On June 24, 2020 3:04:40 AM UTC, "谭小俊(Xiaojun Tan)" <tanxiaojun at oppo.com> wrote:
>Hi, all,
>
>Sorry to bother you.
>
>I recently started using libwebsockets for sending and receiving 
>network packets.
>
>But when I plan to use it to send and receive UDP multicast packets, I 
>don't know how to do it. I also did not find corresponding tips from 
>any documents and examples.

Right...

>And there is no corresponding code in the source code, so I want to ask 
>whether it supports sending and receiving multicast packets. If not, 
>can I manually join the multicast group through the corresponding 
>sockfd in libwebsockets (using setsockopt).

Multicast groups is a long way away from lws original focus only on tcp based protocols.  But lws is slowly spreading out there, eg, it comes with dhcp client, ntp client and async dns resolver now all of which are UDP.

I didn't get a chance to complete it yet but there is also a generic lws mDNS client / server patch out of tree that is of course multicast... afaik mDNS is the only common use for multicasting.  There, it wraps the multicasting C apis in mDNS semantics and exposes only mDNS apis.  The mDNS implementation is part of lws rather than user code but unless there's another use for multicast I didn't think about, the general plan is eventually provide mDNS rather than provide wrappers for standard multicast apis.  As you say you can just use the standard C multicast apis on the socketfd.

-Andy

>Thanks.
>Xiaojun.
>________________________________
>OPPO
>
>本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您
>错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。
>
>This e-mail and its attachments contain confidential information from 
>OPPO, which is intended only for the person or entity whose address is 
>listed above. Any use of the information contained herein in any way 
>(including, but not limited to, total or partial disclosure, 
>reproduction, or dissemination) by persons other than the intended
>recipient(s) is prohibited. If you receive this e-mail in error, please 
>notify the sender by phone or email immediately and delete it!


More information about the Libwebsockets mailing list