import asyncdispatch, asyncnet
    
    template asyncDo(x) = asyncCheck (proc {.async.} = x)()
    
    let s = newAsyncSocket()
    s.setSockOpt(OptReuseAddr, true)
    s.bindAddr Port 12345
    s.listen
    
    let c1, c2 = newAsyncSocket()
    for c in [c1, c2]:
      asyncCheck c.connect("localhost", Port 12345)
    
    asyncDo:
      while true:
        let c = await s.accept
        asyncDo:
          while true:
            echo repr c.getFd
            await sleepAsync 2000
    
    runForever()
    
    
    Run

Ouput: 
    
    
    21
    22
    22
    22
    22
    22
    22
    22
    (...)
    
    
    Run

The first two lines are as I would expect, but what's up with the rest? Why is 
FD 21 suddenly gone?

Reply via email to