dongzhitao4839 2017-09-15 20:35
浏览 54

在Go中发现python服务

I currently have a http server implemented in python using flask. The service is registered using the zeroconf module:

info = ServiceInfo('_http._tcp.local.',
                   'MyServer._http._tcp.local.',
                   inet_aton(host), port, properties={})
zc = Zeroconf()
zc.register_service(info, allow_name_change=True)

Also, I have a go application browsing the available services using zeroconf. The problem is that if I start the go program after the python server the go program never discovers the server. If I start the go program first there's no issue. I even try extending the ttl on the register_service function with no results.

I'm trying that the go program discovers the python servers that where already running when it gets started.

I recently discover that the go part functions perfectly, I register the service using avahi-publish and go discover it correctly. So I guess the python module is the problem. I know now that I can run avahi but I would like a python implementation of the protocol, having dependencies only in python.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题