import net
    
    const sock_addr = "\0com.localserver.myapp.sock"
    
    when isMainModule:
      var sock = newSocket(AF_UNIX, SOCK_DGRAM, IPPROTO_IP)
      try:
        sock.bindUnix(sock_addr)
        echo "connection successful. listening"
        while true:
          discard 1+1 # how does one create an infinite loop?
      except:
        let e = getCurrentException()
        if e is OSError:
          echo e.errorCode
    
    
    Run

in this code, I want to be able to detect a specific error code (EADDRINUSE) 
from the exception e. How can I do this?

Reply via email to