Hello,
I can’t get unixgram working ; I have the same problem that the one
described in this thread :
http://groups.google.com/group/golang-nuts/browse_thread/thread/7d387e4f38ccb500
(in short : ReadFrom returns an error, "address family not supported
by protocol")
./all.bash shows no error. I test it with socat ; to be more precise,
"socat UNIX-RECVFROM:/tmp/test-udg STDOUT" followed by "echo test |
socat STDIN UNIX-SENDTO:/tmp/test-udg" works as expected, whereas "./
test-udg" (from test-udg.go) followed by "echo test | socat STDIN UNIX-
SENDTO:/tmp/test-udg" results in the error described above.
The error is still here if I use ListenUnixgram instead of
ListenPacket (BTW, why does ListenUnixgram returns an UPDConn ?
doesn't sounds logical to me ;))
Here is test-udg.go :
package main
import (
"net"
"fmt"
"os"
)
func main() {
c, err := net.ListenPacket("unixgram", "/tmp/test-udg")
if err != nil {
panic(fmt.Sprintf("ListenPacket failed: %v\n", err))
}
for {
buf := make([]byte, 258)
length, _, err := c.ReadFrom(buf)
if err != nil {
fmt.Fprintf(os.Stderr, "ReadFrom failed: %v
\n", err)
return
}
print(string(buf[:length]))
}
}
Any help would be appreciated ;)