Unixgram not working ?

Skip to first unread message

Simon Lipp

Sep 15, 2011, 10:18:59 AM9/15/11
to golang-nuts

I can’t get unixgram working ; I have the same problem that the one
described in this thread :


(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 (

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)

Any help would be appreciated ;)

Kyle Lemons

Sep 15, 2011, 4:20:38 PM9/15/11
to Simon Lipp, golang-nuts
I don't understand all of the intricacies of unixgram, but when you're dialing from Go that problem seems to be avoided by specifying a local address.  I'm not sure if this is a limitation in our datagram server or not.

Reply all
Reply to author
0 new messages