Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Address family not supported by protocol family

Tags:

ruby

unicorn

I tried to do the ruby example shown in this page: http://tomayko.com/writings/unicorn-is-unix

but all I got was

echo.rb:9:in `bind': Address family not supported by protocol family - bind(2) (Errno::EAFNOSUPPORT)
    from echo.rb:9:in `<main>'

Any idea?

like image 352
jaycode Avatar asked Dec 05 '10 00:12

jaycode


People also ask

What is address family not supported by protocol?

This error will usually indicate there is a problem with the loopback interface containing an invalid address. Often, the issue is that IPv6 is disabled, but the localhost entry contains an IPv6 address like ::1.

What is address family in networking?

Address family protocols provide the network transportation of application data from one application to another (or from one process to another within the same system). The application specifies the network transport provider on the protocol parameter of the socket.


1 Answers

I've encountered the same problem. Just change the localhost to 0.0.0.0:

address = Socket.pack_sockaddr_in(4242, '0.0.0.0')

It seems to appear on Mac only.

like image 157
Kevin Avatar answered Sep 18 '22 07:09

Kevin