在 Python 中选择多播网络接口 [英] Choosing multicast network interface in Python

查看:72
本文介绍了在 Python 中选择多播网络接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台带有两个独立以太网连接的服务器.当我在 python 中绑定一个套接字时,它默认为两个网络之一.如何从 Python 中的第二个网络中提取多播流?我曾尝试在第二个网络上使用服务器的 IP 地址调用 bind,但没有奏效.

I have a server with two separate Ethernet connections. When I bind a socket in python it defaults to one of the two networks. How do I pull a multicast stream from the second network in Python? I have tried calling bind using the server's IP address on the second network, but that hasn't worked.

推荐答案

我想通了.事实证明,我缺少的部分是将接口添加到用于向多播组添加成员资格的 mreq 结构中.

I figured it out. It turns out that the piece I was missing was adding the interface to the mreq structure that is used in adding membership to a multicast group.

这篇关于在 Python 中选择多播网络接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆