FAQ
Hello ,everyone. I have two golang programes. One is server,the other is
client.

server code:
   http://play.golang.org/p/674MybCISh

client code:
   http://play.golang.org/p/ND8T_UcZdR

when they are running, cpu will reach to 100%.After print some messages ,
server will print ' WSARecv tcp 127.0.0.1:20006: An existing connection
was forcibly closed by the remote host.

And the client also print ' ConnectEx tcp: No connection could be made
because the target machine actively refused it '.

The code has any problem? Thanks

golang version :1.3
OS: win7 64bit

--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Shawn Milochik at Nov 7, 2014 at 5:29 pm

    On Fri, Nov 7, 2014 at 1:34 AM, wrote:
    The code has any problem? Thanks
    The first thing I see is that the error returned by con.Write() is being
    ignored. Try checking that first and see if that leads anywhere.

    --
    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 [email protected].
    For more options, visit https://groups.google.com/d/optout.
  • Nick Patavalis at Nov 8, 2014 at 12:04 am

    On Friday, November 7, 2014 8:34:10 AM UTC+2, [email protected] wrote:

    The code has any problem? Thanks
    1. The for loop in server Do() is wrong (it reads over and over in the same
    buffer)
    2. You are accessing (writing and reading) "count" from multiple goroutines
    without synchronization
    3. Are you sure the OS isn't limiting the number of TCP connections?

    Fix 1 and 2 and try with a reasonable number (say 10 or 100)...
    /npat

    --
    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 [email protected].
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 7, '14 at 6:34a
activeNov 8, '14 at 12:04a
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2023 Grokbase