Address family not supported by protocol family.

我的udp程序,运行时提示错误:  
  sendto   error   in   udptalk.c!  
  Address   family   not   supported   by   protocol   family.  
  我使用的协议socket( AF_INET,SOCK_DGRAM,0)  
  请教错误原因。  

I   think   the   problem   is   the   third   parameter.   It   must   be   IPPROTO_UDP   which   is   defined   as   17   on   solaris.   0   is   defined   as   IPPROTO_IP   (dummy   for   IP).


Hello,

I use IPV4.

I have found a workaround:

Edit C:\Windows\System32\drivers\etc\hosts and add the line "127.0.0.1 localhost" .

Regards,

Stefan



>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1

>
>Hi there,
>
>i see the following messages in a servers log (2.1.5 on debian
>that is):
>postfix/smtp[31937]: socket to some.remote.host[]: Address family not
>supported by protocol (port 25)
>
>after that, a TLS session to some.remote.host is established and
>the mail gets delivered. The remote host has one ipv6 and one v4
>record so i guess the error comes from the v6 record since v6 isn't
>available on the server. Its the first server where i've seen such
>a message and it doesn't seem to "break" something, but it's annoying.
>Any idea what causes this and how to disable the message?
>
>
lookup for some.remote.host returns an AAAA record that is tried and
yields the error above. disable IPv6 in your dns server.
if using a remote dns server, install one on the postfix box.



最终的解决方法
增加
sin.sin_family=AF_INET;

你可能感兴趣的:(Address family not supported by protocol family.)