Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004535OCamlOCaml generalpublic2008-04-16 18:072009-09-22 10:45
Assigned To 
PlatformOSOS Version
Product Version3.10.1 
Target VersionFixed in Version 
Summary0004535: please add function to distinguish IPv6 inet_addrs
DescriptionPlease add a function to the Unix module that allows one to distinguish between IPv4 and IPv6 inet_addrs.

For example, when printing a sockaddr, I would like to print for an IPv4 host, but
   [::1]:666 for an IPv6 one.
Of course, I can search for ':' in the string returned by string_of_inet_addr, but that's a hack.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
dra (reporter)
2009-09-22 10:45

This can already be done by using Unix.domain_of_sockaddr which will return Unix.PF_INET for an IPv4 address or Unix.PF_INET6 for an IPv6 address.

However, this is tedious as it requires you to create a socket just to determine the address family of an inet_addr.

Both win32unix/ and unix/ contain a function called is_inet6_addr which is used in Unix.domain_of_sockaddr - could this function be added to unix.mli in the next release of OCaml?

- Issue History
Date Modified Username Field Change
2008-04-16 18:07 ecc New Issue
2008-09-23 02:51 doligez Status new => acknowledged
2009-09-22 10:45 dra Note Added: 0005115

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker