免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6272 | 回复: 3
打印 上一主题 下一主题

FreeBSD 报错:Address family not supported by protocol family [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-28 11:06 |只看该作者 |倒序浏览
请问我在FreeBSD 报错:Address family not supported by protocol family是为什么?
同样的代码我在Linux下运行很好。

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2006-06-28 11:45 |只看该作者
贴出来看看。

论坛徽章:
0
3 [报告]
发表于 2006-06-28 13:11 |只看该作者
进哪家馆子点哪家菜,有什么好为什么的?

FreeBSD6.0:

  1. /*
  2. * Address families.
  3. */
  4. #define    AF_UNSPEC    0        /* unspecified */
  5. #if __BSD_VISIBLE
  6. #define    AF_LOCAL    AF_UNIX        /* local to host (pipes, portals) */
  7. #endif
  8. #define    AF_UNIX        1        /* standardized name for AF_LOCAL */
  9. #define    AF_INET        2        /* internetwork: UDP, TCP, etc. */
  10. #if __BSD_VISIBLE
  11. #define    AF_IMPLINK    3        /* arpanet imp addresses */
  12. #define    AF_PUP        4        /* pup protocols: e.g. BSP */
  13. #define    AF_CHAOS    5        /* mit CHAOS protocols */
  14. #define    AF_NETBIOS    6        /* SMB protocols */
  15. #define    AF_ISO        7        /* ISO protocols */
  16. #define    AF_OSI        AF_ISO
  17. #define    AF_ECMA        8        /* European computer manufacturers */
  18. #define    AF_DATAKIT    9        /* datakit protocols */
  19. #define    AF_CCITT    10        /* CCITT protocols, X.25 etc */
  20. #define    AF_SNA        11        /* IBM SNA */
  21. #define AF_DECnet    12        /* DECnet */
  22. #define AF_DLI        13        /* DEC Direct data link interface */
  23. #define AF_LAT        14        /* LAT */
  24. #define    AF_HYLINK    15        /* NSC Hyperchannel */
  25. #define    AF_APPLETALK    16        /* Apple Talk */
  26. #define    AF_ROUTE    17        /* Internal Routing Protocol */
  27. #define    AF_LINK        18        /* Link layer interface */
  28. #define    pseudo_AF_XTP    19        /* eXpress Transfer Protocol (no AF) */
  29. #define    AF_COIP        20        /* connection-oriented IP, aka ST II */
  30. #define    AF_CNT        21        /* Computer Network Technology */
  31. #define pseudo_AF_RTIP    22        /* Help Identify RTIP packets */
  32. #define    AF_IPX        23        /* Novell Internet Protocol */
  33. #define    AF_SIP        24        /* Simple Internet Protocol */
  34. #define    pseudo_AF_PIP    25        /* Help Identify PIP packets */
  35. #define    AF_ISDN        26        /* Integrated Services Digital Network*/
  36. #define    AF_E164        AF_ISDN        /* CCITT E.164 recommendation */
  37. #define    pseudo_AF_KEY    27        /* Internal key-management function */
  38. #endif
  39. #define    AF_INET6    28        /* IPv6 */
  40. #if __BSD_VISIBLE
  41. #define    AF_NATM        29        /* native ATM access */
  42. #define    AF_ATM        30        /* ATM */
  43. #define pseudo_AF_HDRCMPLT 31        /* Used by BPF to not rewrite headers
  44.                      * in interface output routine
  45.                      */
  46. #define    AF_NETGRAPH    32        /* Netgraph sockets */
  47. #define    AF_SLOW        33        /* 802.3ad slow protocol */
  48. #define    AF_SCLUSTER    34        /* Sitara cluster protocol */
  49. #define    AF_ARP        35
  50. #define    AF_BLUETOOTH    36        /* Bluetooth sockets */
  51. #define    AF_MAX        37
  52. #endif
复制代码


Linux2.6.16:
  1. /* Supported address families. */
  2. #define AF_UNSPEC        0
  3. #define AF_UNIX                1        /* Unix domain sockets                 */
  4. #define AF_LOCAL        1        /* POSIX name for AF_UNIX        */
  5. #define AF_INET                2        /* Internet IP Protocol         */
  6. #define AF_AX25                3        /* Amateur Radio AX.25                 */
  7. #define AF_IPX                4        /* Novell IPX                         */
  8. #define AF_APPLETALK        5        /* AppleTalk DDP                 */
  9. #define AF_NETROM        6        /* Amateur Radio NET/ROM         */
  10. #define AF_BRIDGE        7        /* Multiprotocol bridge         */
  11. #define AF_ATMPVC        8        /* ATM PVCs                        */
  12. #define AF_X25                9        /* Reserved for X.25 project         */
  13. #define AF_INET6        10        /* IP version 6                        */
  14. #define AF_ROSE                11        /* Amateur Radio X.25 PLP        */
  15. #define AF_DECnet        12        /* Reserved for DECnet project        */
  16. #define AF_NETBEUI        13        /* Reserved for 802.2LLC project*/
  17. #define AF_SECURITY        14        /* Security callback pseudo AF */
  18. #define AF_KEY                15      /* PF_KEY key management API */
  19. #define AF_NETLINK        16
  20. #define AF_ROUTE        AF_NETLINK /* Alias to emulate 4.4BSD */
  21. #define AF_PACKET        17        /* Packet family                */
  22. #define AF_ASH                18        /* Ash                                */
  23. #define AF_ECONET        19        /* Acorn Econet                        */
  24. #define AF_ATMSVC        20        /* ATM SVCs                        */
  25. #define AF_SNA                22        /* Linux SNA Project (nutters!) */
  26. #define AF_IRDA                23        /* IRDA sockets                        */
  27. #define AF_PPPOX        24        /* PPPoX sockets                */
  28. #define AF_WANPIPE        25        /* Wanpipe API Sockets */
  29. #define AF_LLC                26        /* Linux LLC                        */
  30. #define AF_TIPC                30        /* TIPC sockets                        */
  31. #define AF_BLUETOOTH        31        /* Bluetooth sockets                 */
  32. #define AF_MAX                32        /* For now.. */
复制代码

[ 本帖最后由 雨丝风片 于 2006-6-28 13:12 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-06-29 16:46 |只看该作者
谢谢楼上的回复,问题我已经解决了;
因为我在发送地址结构体中少设置了属性sin_family = AF_INET;
由于时间紧张我也没有仔细研究,估Linux 下面sin_family不用设置也能顺利工作;

看来还是要仔细编程了;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP