(lib network) Should inet_aton be called instead of inet_addr ?

Hi @ll Reading http://linux.die.net/man/3/inet_addr I noticed that inet_addr is obsolete and inet_aton should be used because inet_addr indicates error by returning -1 which is a valid address (255.255.255.0) as well. Don't know wether it's worth changing or wether inet_aton is peresent on all systems Marc Weber

On Thu, Sep 18, 2008 at 02:32:45AM +0200, Marc Weber wrote:
Hi @ll
Reading http://linux.die.net/man/3/inet_addr I noticed that inet_addr is obsolete and inet_aton should be used because inet_addr indicates error by returning -1 which is a valid address (255.255.255.0) as well. Don't know wether it's worth changing or wether inet_aton is peresent on all systems
I'd also suggest to change inet_addr :: String -> IO HostAddress -- throwing user exception to inet_addr :: String -> IO (Maybe HostAddress) -- not throwing any exception or inet_addr :: String -> IO (Either String HostAddress) -- not throwing any exception because the latter can be type checked the first one not.. The problem with the first one is that using a custom exception (which is easy when extensible extensions become standard) would be a better choice. But changing the exception type would break libraries. Using a return type of Maybe would never ever break things again See also my last post on haskell-cafe Marc

Hi Marc, On Thu, Sep 18, 2008 at 03:24:21PM +0200, Marc Weber wrote:
I'd also suggest to change inet_addr :: String -> IO HostAddress -- throwing user exception to inet_addr :: String -> IO (Maybe HostAddress) -- not throwing any exception or inet_addr :: String -> IO (Either String HostAddress) -- not throwing any exception
Can you please file this as a library proposal?: http://www.haskell.org/haskellwiki/Library_submissions Thanks Ian

Hi Marc, On Thu, Sep 18, 2008 at 02:32:45AM +0200, Marc Weber wrote:
Reading http://linux.die.net/man/3/inet_addr I noticed that inet_addr is obsolete and inet_aton should be used because inet_addr indicates error by returning -1 which is a valid address (255.255.255.0) as well. Don't know wether it's worth changing or wether inet_aton is peresent on all systems
It sounds like we shouldchange, although I too don't know how portable inet_aton is. Could you file a proposal please?: http://www.haskell.org/haskellwiki/Library_submissions Thanks Ian

On Mon, Sep 22, 2008 at 07:45:48PM +0100, Ian Lynagh wrote:
Reading http://linux.die.net/man/3/inet_addr I noticed that inet_addr is obsolete and inet_aton should be used because inet_addr indicates error by returning -1 which is a valid address (255.255.255.0) as well. Don't know wether it's worth changing or wether inet_aton is peresent on all systems
It sounds like we shouldchange, although I too don't know how portable inet_aton is.
It isn't POSIX, but it's historically from 4.3BSD, so all the BSDs, MacOS X should support it, too. I also just verified that it's available on a good old IRIX 5.3 ;-) And since Solaris was originally based on BSD, it may have inet_aton, too. No idea about other systems. Ciao, Kili

On 2008 Sep 22, at 15:13, Matthias Kilian wrote:
On Mon, Sep 22, 2008 at 07:45:48PM +0100, Ian Lynagh wrote:
Reading http://linux.die.net/man/3/inet_addr I noticed that inet_addr is obsolete and inet_aton should be used because inet_addr indicates error by returning -1 which is a valid address (255.255.255.0) as well. Don't know wether it's worth changing or wether inet_aton is peresent on all systems
It sounds like we shouldchange, although I too don't know how portable inet_aton is.
It isn't POSIX, but it's historically from 4.3BSD, so all the BSDs, MacOS X should support it, too. I also just verified that it's available on a good old IRIX 5.3 ;-)
And since Solaris was originally based on BSD, it may have inet_aton, too. No idea about other systems.
Solaris 10+ probably does, but our Solaris 9 machines don't. Linux and OSX have inet_aton. (Solaris 2 is not based on BSD, but on AT&T System V. For example, it didn't get real sockets until 2.6; before that they were emulated on top of System V streams.) -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (4)
-
Brandon S. Allbery KF8NH
-
Ian Lynagh
-
Marc Weber
-
Matthias Kilian