FAQ
Recently Great Firewall in China is more powerful and pollute Google
Domain. When try to net.LookupMX("gmail.com"), it may halt a long time and
no return.

Is there a way to let net.LookupMX timeout? Although it won't block the
other request, I hope it can release after a while and receive a timeout
error.

And, net.smtp doesn't have timeout.

--

Search Discussions

  • Kamil Kisiel at Nov 15, 2012 at 7:04 am
    It seems the Lookup functions all get their options from /etc/resolv.conf
    (at least on unix, I'm not familiar with how this stuff works on Windows).

    You should be able to add a line that says

    options timeout:n

    to /etc/resolv.conf to change the timeout. There's also numerous other
    options which may be useful in speeding up your DNS resolution, check man 5
    resolver or man 5 resolv.conf.
    On Wednesday, November 14, 2012 10:12:07 PM UTC-8, Googol Lee wrote:

    Recently Great Firewall in China is more powerful and pollute Google
    Domain. When try to net.LookupMX("gmail.com"), it may halt a long time
    and no return.

    Is there a way to let net.LookupMX timeout? Although it won't block the
    other request, I hope it can release after a while and receive a timeout
    error.

    And, net.smtp doesn't have timeout.
    --
  • Googol Lee at Nov 15, 2012 at 7:19 am
    Thanks for rapid reply. It's helpful.
    On Thursday, November 15, 2012 3:04:45 PM UTC+8, Kamil Kisiel wrote:

    It seems the Lookup functions all get their options from /etc/resolv.conf
    (at least on unix, I'm not familiar with how this stuff works on Windows).

    You should be able to add a line that says

    options timeout:n

    to /etc/resolv.conf to change the timeout. There's also numerous other
    options which may be useful in speeding up your DNS resolution, check man 5
    resolver or man 5 resolv.conf.
    On Wednesday, November 14, 2012 10:12:07 PM UTC-8, Googol Lee wrote:

    Recently Great Firewall in China is more powerful and pollute Google
    Domain. When try to net.LookupMX("gmail.com"), it may halt a long time
    and no return.

    Is there a way to let net.LookupMX timeout? Although it won't block the
    other request, I hope it can release after a while and receive a timeout
    error.

    And, net.smtp doesn't have timeout.
    --
  • Martin Kühl at Nov 15, 2012 at 2:34 pm
    There is a very nice example and description of adding timeouts here:
    https://gobyexample.com/timeouts
    On Thu, Nov 15, 2012 at 7:12 AM, Googol Lee wrote:
    Recently Great Firewall in China is more powerful and pollute Google Domain.
    When try to net.LookupMX("gmail.com"), it may halt a long time and no
    return.

    Is there a way to let net.LookupMX timeout? Although it won't block the
    other request, I hope it can release after a while and receive a timeout
    error.

    And, net.smtp doesn't have timeout.

    --
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 15, '12 at 6:12a
activeNov 15, '12 at 2:34p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase