• 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: Telnet Networking Example
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Telnet Networking Example


  • Subject: Re: Telnet Networking Example
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 23 Jul 2009 15:29:44 -0700


On Jul 23, 2009, at 3:20 PM, DerNalia wrote:

       server_host = @"127.0.0.1";
       NSURL *website = [NSURL URLWithString:server_host];

FYI, this was your problem. "127.0.0.1", interpreted as a URL, is just a relative reference to some resource called "127.0.0.1". NSURL isn't going to treat it as a hostname.


If you really wanted to create a URL out of this, you'd need a scheme prefix, like "telnet:127.0.0.1".

NSHost *host = [NSHost hostWithName:[website host]];

Converting a host name into a URL and then extracting the host out of it is pretty roundabout. You can just use
NSHost *host = [NSHost hostWithName: server_host];


The -hostWithAddress: call you've got now will work with numeric addresses like the above, but if you put in something like "foobar.com" it'll fail. -hostWithName: should handle both cases.

—Jens

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


References: 
 >Telnet Networking Example (From: DerNalia <email@hidden>)
 >Re: Telnet Networking Example (From: Jens Alfke <email@hidden>)
 >Re: Telnet Networking Example (From: DerNalia <email@hidden>)
 >Re: Telnet Networking Example (From: Eli Bach <email@hidden>)
 >Re: Telnet Networking Example (From: DerNalia <email@hidden>)
 >Re: Telnet Networking Example (From: Eli Bach <email@hidden>)
 >Re: Telnet Networking Example (From: DerNalia <email@hidden>)
 >Re: Telnet Networking Example (From: Eli Bach <email@hidden>)
 >Re: Telnet Networking Example (From: DerNalia <email@hidden>)

  • Prev by Date: Re: Telnet Networking Example
  • Next by Date: UDP Flow Control
  • Previous by thread: Re: Telnet Networking Example
  • Next by thread: UDP Flow Control
  • Index(es):
    • Date
    • Thread