Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in NSStream or NSHost?



Hello,

I posted back in June about what seems to be a bug in either NSStream or NSHost. This bug shows up when you attempt to connect to a host specified by IP address when the reverse DNS lookup returns a hostname that does not resolve.

I've attached the source to the test program I wrote to test this out, and you can see the log below of the results.

I haven't been able to find any programmatic solutions to this problem. The best I can do is add a hostname to my /etc/hosts file that resolves to the IP.

Thanks,
Samuel

Attachment: testnshost.m
Description: Binary data


On Jun 8, 2005, at 12:09 AM, Samuel Tesla wrote:

Hey all,

I ran across a very interesting problem with NSStream.

When I create an NSHost object, it appears to do its best to fill both the address and the names out. If I create it using and IP, it will do reverse DNS lookups. The interesting problem comes up when I create an NSHost from an IP address, but the hostname that reverse DNS finds is not a good one. In that case it gets errors when it tries to get the streams.

I've attached the program I used to generate the following output.

Here's a perfectly good host:

$ host 155.53.1.242
242.1.53.155.in-addr.arpa domain name pointer veal.babymeat.com.
$ host veal.babymeat.com
veal.babymeat.com has address 155.53.1.242
$ ./testnshost 155.53.1.242 7777
2005-06-07 23:51:48.215 testnshost[21836] Testing: 155.53.1.242 7777
2005-06-07 23:51:48.422 testnshost[21836] NSStreamEventOpenCompleted
2005-06-07 23:51:48.423 testnshost[21836] NSStreamEventOpenCompleted
2005-06-07 23:51:48.423 testnshost[21836] NSStreamEventHasSpaceAvailable
2005-06-07 23:51:48.543 testnshost[21836] NSStreamEventHasBytesAvailable


Here's a bad host:

$ host 212.13.197.5
5.197.13.212.in-addr.arpa domain name pointer sneaky.geekstuff.co.uk.
$ host sneaky.geekstuff.co.uk.
Host sneaky.geekstuff.co.uk not found: 3(NXDOMAIN)
$ ./testnshost 212.13.197.5 7773
2005-06-07 23:52:06.032 testnshost[21838] Testing: 212.13.197.5 7773
2005-06-07 23:52:06.051 testnshost[21838] NSStreamEventErrorOccurred: Error NSUnknownErrorDomain 7
2005-06-07 23:52:06.053 testnshost[21838] NSStreamEventErrorOccurred: Error NSUnknownErrorDomain 7


Anybody have an idea about this? It seems that NSStream is using [host name] instead of [host address]...but that seems odd.

Thanks,
Samuel

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.