I have a daemon that listens on a specific unix domain socket file. At some point it spawns a child which should continue listen on the same socket file without open a new one and overwriting the old one. I need a method that listen on a specific FD. In C it can be done with accept():
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
Please advise.
net.FileListener
is used to turn a file descriptor into a net.Listener
f := os.NewFile(sockfd, "from parent")
l, err := net.FileListener(f)
if err != nil {
log.Fatal(err)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With