[ee122] address family not supported by protocol family
fowler at eecs.berkeley.edu
Thu Dec 6 14:13:31 PST 2007
On Dec 6, 2007 2:04 PM, Haley Nguyen <haley.ng at gmail.com> wrote:
> I wrote a sender and a receiver. The sender sends then waits for receiver
> from the receiver. The receiver waits for receive then send back and ack.
> This is my socket call: socket(PF_INET, SOCK_DGRAM, 0)
> Then I set AF_INET for my sockaddr_in as the Beej suggested.
> I tested on localhost instead of ilinux3
> The receiver runs on ilinux3 (the network is localhost), and a macbook, but
> it doesn't run on c199. The error returned was: Address family not supported
> by protocol family.
> The sender runs fine.
> I tried to use AF_INET for the socket() and AF_INET for sockaddr_in, the
> problem is the same.
> Can anyone tell me what the problem is?
That generally is indicative of the sockaddr struct not being passed
properly to the syscall. Double check that you're correctly sending a
struct sockaddr* and not something else. If you still have problems,
you can send me a code snippet off-list.
More information about the ee122