Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Python Zeroconf发送数据_Python_Zeroconf - Fatal编程技术网

如何使用Python Zeroconf发送数据

如何使用Python Zeroconf发送数据,python,zeroconf,Python,Zeroconf,我看到了一个 本教程介绍了如何创建Python Zeroconf侦听器,以便我知道如何接收数据 这是下面 from zeroconf import ServiceBrowser, Zeroconf class MyListener: def remove_service(self, zeroconf, type, name): print("Service %s removed" % (name,)) def add_service(se

我看到了一个

本教程介绍了如何创建Python Zeroconf侦听器,以便我知道如何接收数据

这是下面

from zeroconf import ServiceBrowser, Zeroconf

class MyListener:

    def remove_service(self, zeroconf, type, name):
        print("Service %s removed" % (name,))

    def add_service(self, zeroconf, type, name):
        info = zeroconf.get_service_info(type, name)
        print("Service %s added, service info: %s" % (name, info))


zeroconf = Zeroconf()
listener = MyListener()
browser = ServiceBrowser(zeroconf, "_http._tcp.local.", listener)
try:
    input("Press enter to exit...\n\n")
finally:
    zeroconf.close()

但它似乎没有写下如何发送数据。是否可以使用Python Zeroconf发送数据?如何发送它?

Zeroconf是让客户端查找服务和连接到哪个端口,而不是实际的数据传输。 网上有关于用python创建简单客户端和服务器的教程。 这里有一个