首页 \ 问答 \ 我如何在Ubuntu 14.04上安装pybonjour(How do I install pybonjour on Ubuntu 14.04)

我如何在Ubuntu 14.04上安装pybonjour(How do I install pybonjour on Ubuntu 14.04)

获取此错误ImportError: No module named pybonjour

我如何在Ubuntu 14.04上安装pybonjour。

试过sudo apt-get install pybonjourpip install pybonjour ,没有运气。


Getting this error ImportError: No module named pybonjour

How do I install pybonjour on Ubuntu 14.04.

Tried sudo apt-get install pybonjour and pip install pybonjour, no luck.


原文:https://stackoverflow.com/questions/28896572
更新时间:2022-10-23 06:10

最满意答案

默认的http.Transport过快地打开和关闭连接。 由于所有连接都是相同的主机:端口组合,因此需要增加MaxIdleConnsPerHost以匹配MaxIdleConnsPerHost的值。 否则,传输将经常关闭额外的连接,只是让它们立即重新打开。

您可以在默认传输上全局设置:

http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = numCoroutines

或者在创建自己的运输时

t := &http.Transport{
    Proxy: http.ProxyFromEnvironment,
    DialContext: (&net.Dialer{
        Timeout:   30 * time.Second,
        KeepAlive: 30 * time.Second,
    }).DialContext,
    MaxIdleConnsPerHost:   numCoroutines,
    MaxIdleConns:          100,
    IdleConnTimeout:       90 * time.Second,
    TLSHandshakeTimeout:   10 * time.Second,
    ExpectContinueTimeout: 1 * time.Second,
}

类似的问题: 去http.Get,并发,和“由同行重置连接”


The default http.Transport is opening and closing connections too quickly. Since all connections are to the same host:port combination, you need to increase MaxIdleConnsPerHost to match your value for num_coroutines. Otherwise, the transport will frequently close the extra connections, only to have them reopened immediately.

You can set this globally on the default transport:

http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = numCoroutines

Or when creating your own transport

t := &http.Transport{
    Proxy: http.ProxyFromEnvironment,
    DialContext: (&net.Dialer{
        Timeout:   30 * time.Second,
        KeepAlive: 30 * time.Second,
    }).DialContext,
    MaxIdleConnsPerHost:   numCoroutines,
    MaxIdleConns:          100,
    IdleConnTimeout:       90 * time.Second,
    TLSHandshakeTimeout:   10 * time.Second,
    ExpectContinueTimeout: 1 * time.Second,
}

Similar question: Go http.Get, concurrency, and "Connection reset by peer"

相关问答

更多
  • 为什么会这样? 因为那是它应该做的 。 Linux系统上/ proc / sys / net / ipv4 / tcp_fin_timeout的默认值是60秒(恕我直言,这对于大多数用途来说有点过分)。 您可以通过写入文件来更改它。 Why would this be? Because that's what it's supposed to do. The default value for /proc/sys/net/ipv4/tcp_fin_timeout on a Linux system is 6 ...
  • TIME_WAIT每个套接字在内核中消耗一些内存,通常略低于ESTABLISHED套接字,但仍然很重要。 足够大的数量可以排除内核内存,或至少降低性能,因为该内存可以用于其他目的。 TIME_WAIT套接字不持有打开的文件描述符(假设它们已正确关闭),因此您不必担心“打开的文件太多”错误。 套接字还绑定了特定的src / dst IP地址和端口,因此它不能在TIME_WAIT间隔的持续时间内重复使用。 (这是TIME_WAIT状态的预期目的。)绑定端口通常不是问题,除非您需要重新连接相同的端口对。 最常见的 ...
  • TCP连接由元组(源IP,源端口,目标IP,目标端口)指定。 在会话关闭后有一个TIME_WAIT状态的原因是因为在您到达您的路上可能还存在网络中的实时数据包(或从您可能会请求某种响应)。 如果您要重新创建相同的元组,并且其中一个数据包显示,则将被视为连接的有效数据包(并且可能会由于排序而导致错误)。 因此,TIME_WAIT时间通常设置为包最大年龄的两倍。 该值是网络丢弃它们之前允许数据包到达的最大年龄。 这样可以保证在允许使用同一个元组创建连接之前,属于该元组的先前化身的所有数据包都将被停止。 这通常决 ...
  • 在这种情况下,无需维护状态信息。 RFC 4960定义了一种对未知(突然出现)数据包的默认处理。 假设您在关联中有两个方面:A侧和B侧.v1 / v2是这些方使用的验证标签。 A侧启动关机。 ` A B Shutdown(v1) --------------------> Shutdown_ack(v2) <-------------------- Shutdown_complete(v1) ------------------ ...
  • 默认的http.Transport过快地打开和关闭连接。 由于所有连接都是相同的主机:端口组合,因此需要增加MaxIdleConnsPerHost以匹配MaxIdleConnsPerHost的值。 否则,传输将经常关闭额外的连接,只是让它们立即重新打开。 您可以在默认传输上全局设置: http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = numCoroutines 或者在创建自己的运输时 t := &http.Transport{ ...
  • “TIME_WAIT”是TCP连接在关闭(FIN / FIN接收)后的可配置时间内保持的状态。 以这种方式,一个连接的可能“延迟”分组不能与重用相同端口的后一个连接混合。 在高流量测试中,拥有很多它们是正常的,但是在测试完成几分钟后它们应该消失。 "TIME_WAIT" is the state that a TCP connection mantains during a configurable amount of time after closed (FIN/FIN reception). In th ...
  • 套接字选项SO_LINGER确实阻止套接字进入TIME_WAIT。 但TIME_WAIT有一个原因:它应该保护您免受来自旧连接的延迟数据包的影响。 因此,TIME_WAIT的默认持续时间是网络往返的两倍。 因此,在TIME_WAIT中找到一些较旧的连接是正常的。 提供一些上下文:在服务器端,使用侦听套接字,有SO_REUSEADDR套接字选项。 它允许侦听套接字在TIME_WAIT结束之前成功进行绑定。 对于服务器进程,它总是应该监听同一个端口(想想:端口80,443处的webserver),这是必须的。 ...
  • 如果您遵循TCP状态机图,您将看到如果套接字启动发送FIN,则套接字必须转换到TIME-WAIT状态。 使用shutdown(sockTX, 2)而不等待客户端的FIN就是这样。 如果您希望服务器等待客户端的FIN,则先阻止recv()等待0返回值。 然后,你可以close() 。 请注意,除非您以某种方式复制套接字(使用dup*()或使用fork()调用),否则如果紧跟一个close() ,则无需调用shutdown() close() 。 您可以只调用close() (如果套接字已被复制,FIN将仅在最 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)