• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa versus Carbon networking issue.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa versus Carbon networking issue.


  • Subject: Re: Cocoa versus Carbon networking issue.
  • From: j o a r <email@hidden>
  • Date: Fri, 6 Jan 2006 16:21:32 +0100


On 6 jan 2006, at 15.26, Kenny Millar wrote:

I discovered that I can ping the .119 address by both ip address and host
name
I can ping the .120 address only by ip address and NOT by host name.


What I have discovered by using the debugger is that the 'hostWithAddress'
message is returning a host, containing the hostname, not the IP address
(despite only providing the ip address). So it is getting the host name by
some opaque method. Of course the getStreamsToHost message the fails,
because that host is not available via it's hostname.

So, you have some sort of DNS error on your network. That is probably something you would want to look into. But, besides that problem, I agree that if you provide an IP address, there is not really any point for NSHost to try to resolve it to a host name, and discard the actual IP address, just for the fun of it. Perhaps that should be filed as some sort of bug report.


Now, I knocked up a quick test in Carbon using it's equivalent functions,
and guess what? It all works fine in Carbon - the ip address does NOT get
munged to a hostname. The carbon fn I'm using is
CFStreamCreatePairWithSocketToHost(...) .

CoreFoundation is not part of Carbon or Cocoa. If you, for whatever reason, would want to shoe-horn it into one of them, I would say that it fits better into Cocoa - because of coding guidelines, naming conventions, memory management, toll-free bridged objects, et.c.


So how can I force getStreamsToHost to use the ip address and not the
hostname? It seems there is no way to do it.

Use the CF function you just mentioned to create your stream objects, and then cast them to their NS equivalents. CFStream and NSStream objects are "toll-free bridged":


<http://developer.apple.com/documentation/Cocoa/Conceptual/Streams/ Articles/CocoaStreamsOverview.html>

And so, can be freely intermingled (mostly).

j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • RE: Cocoa versus Carbon networking issue.
      • From: "Kenny Millar" <email@hidden>
References: 
 >Cocoa versus Carbon networking issue. (From: "Kenny Millar" <email@hidden>)

  • Prev by Date: Re: Drag and Drop between two Tableviews
  • Next by Date: RE: Cocoa versus Carbon networking issue.
  • Previous by thread: Cocoa versus Carbon networking issue.
  • Next by thread: RE: Cocoa versus Carbon networking issue.
  • Index(es):
    • Date
    • Thread