Address family not supported by protocol

前端 未结 3 923
不思量自难忘°
不思量自难忘° 2021-02-08 01:24

Following code is a socket programming sample for a TCP client.

But when I run this, connect() is returned as Address family not supported by protocol.

I have he

3条回答
  •  别那么骄傲
    2021-02-08 01:58

    I seen this error during bind. Cause was of using localhost instead of IP:

    ./myprogram localhost:7777
    *** exception! `bind' failed for `localhost:7777' (97, Address family not supported by protocol)
    
    ./myprogram 127.0.0.1:7777
    OK! Listening...
    

    In addition: this error happens on one Linux host and does not appear on another. I check and compare network settings on this machines (lo device, /etc/hosts, /etc/host.conf, etc) and not found essential difference

提交回复
热议问题