FAQ
Assuming we are listening on a TCP port (using `listener, err :=
net.Listen("tcp", ":8081")` for example), is it OK to call
`listener.Accept()` in different goroutines concurrently? Does it help with
maximizing accepting speed?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Staven at Mar 26, 2016 at 12:52 pm

    On Fri, Mar 25, 2016 at 10:32:10PM -0700, dc0d wrote:
    Assuming we are listening on a TCP port (using `listener, err :=
    net.Listen("tcp", ":8081")` for example), is it OK to call
    `listener.Accept()` in different goroutines concurrently? Does it help with
    maximizing accepting speed?
    What made you think Accept() is the bottleneck in your program?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Matt Harden at Mar 26, 2016 at 6:17 pm
    Yes it's safe; it's documented as such at https://godoc.org/net#Listener:
    "Multiple goroutines may invoke methods on a Listener simultaneously."
    On Sat, Mar 26, 2016 at 5:52 AM Staven wrote:
    On Fri, Mar 25, 2016 at 10:32:10PM -0700, dc0d wrote:
    Assuming we are listening on a TCP port (using `listener, err :=
    net.Listen("tcp", ":8081")` for example), is it OK to call
    `listener.Accept()` in different goroutines concurrently? Does it help with
    maximizing accepting speed?
    What made you think Accept() is the bottleneck in your program?

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 26, '16 at 5:32a
activeMar 26, '16 at 6:17p
posts3
users3
websitegolang.org

3 users in discussion

Staven: 1 post Dc0d: 1 post Matt Harden: 1 post

People

Translate

site design / logo © 2022 Grokbase