Prayer

在一般中寻求卓越
posts - 1256, comments - 190, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Address family not supported by protocol family.

Posted on 2010-02-10 16:22 Prayer 阅读(9098) 评论(0)  编辑 收藏 引用 所属分类: SOCKET
我的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;

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理