The NSHost class provides methods to access the network name and address information for a host. Instances of the NSHost class represent individual hosts on a network. Use NSHost objects to get the current host’s name and address and to look up other hosts by name or by address.
Questions tagged [nshost]
13 questions
8
votes
8 answers
Find IP address in iphone
I want to find IP address in an application. I am able to find it. But, problem is, it works fins in iphone os 2.0 or so. But, in iphone os 3.0 it is giving me a warning:
warning: no '+currentHost' method found
warning: (Messages without a matching…

Ruchir Shah
- 898
- 3
- 13
- 31
5
votes
3 answers
Alternatives to NSHost in iPhone app
I'm currently using this code
NSHost *host = [NSHost hostWithAddress:hostname];
if (host == nil) {
host = [NSHost hostWithName:hostname];
if (host == nil) {
[self setMessage:@"Invalid IP address or hostname:"];
return;
…

David26th
- 401
- 2
- 12
- 26
5
votes
7 answers
Accessing IP Address with NSHost
I am trying to get the IP Address using NSHost. With the NSHost object I can use the addresses method to access an array of objects one of which is the IP Address. I fear though that the IP Address may change position in the array from one machine…

Eric Brotto
- 53,471
- 32
- 129
- 174
3
votes
2 answers
Using NSHost in iOS
I'm trying to make a socket server application in Swift for iOS. I found this great example:
let addr = "127.0.0.1"
let port = 4000
var host :NSHost = NSHost(address: addr)
var inp :NSInputStream?
var out :NSOutputStream?
…

ntoonio
- 3,024
- 4
- 24
- 28
3
votes
1 answer
DNS lookup with custom DNS server in Objective-C
From a Mac OS X app, I want to resolve some domain names using a specific DNS server (that has not been set in System Preferences), and easily retrieve the resolved addresses.
I can do this in Terminal with nslookup google.com DNS_SERVER but can't…

hally
- 35
- 1
- 5
1
vote
1 answer
How to use NSHost to get the name behind a bunch of LAN ip addresses?
I know how to get the name behind an ip address using the terminal and dig. I.e:
dig @224.0.0.251 -p5353 -x 192.168.0.195 +short
However, I don't want to use NSTask in my application.
How can I use NSHost to get the name behind an ip address within…

Daniel
- 1,473
- 3
- 33
- 63
1
vote
2 answers
NSHost taking an awfully long time
I have an iPhone app that is a client for an existing server application.
I am using the following code to connect, and this code was working fine. Today I started work on the project, and something odd is happening.
When I click "Connect" NSHost…

Dutchie432
- 28,798
- 20
- 92
- 109
1
vote
1 answer
NSHost "currentHost" not recognized
i'd like to use this code to know my ip, but i got 2 warnings that i can't fix for now. I also found this post : Accessing IP Address with NSHost
but i just wanted to understand why this code does not work, if anyone has an answer?
here's my code : …

Paul
- 6,108
- 14
- 72
- 128
1
vote
0 answers
NSHost -localizedName returning nil
I have received a crash report from one user who cannot use the login feature of my OS X app. From reading the backtrace, the problem appears to be that [[NSHost currentHost] localizedName] is returning nil (I am then inserting it into an…

colincameron
- 2,696
- 4
- 23
- 46
0
votes
3 answers
I tried to use NSHost and XCode didn't recognize it
I tried to add an NSHost method and XCode didn't recognize it.
Do you know why this happened?

YosiFZ
- 7,792
- 21
- 114
- 221
0
votes
1 answer
Why does code that uses NSHost compile correctly using the iPhone SDK?
I have some code that was written for Mac OS X and it makes a lot of use of the NSHost class. During my efforts to bring this code to the iPhone, I discovered that NSHost isn't available in the iPhone SDK, and should instead be replaced with…

Jasarien
- 58,279
- 31
- 157
- 188
0
votes
1 answer
Foundation class message is a forward declaration error
NSHost *h = [NSHost hostWithName:name];
Im getting two errors from this line of code
ARC Issue: Receiver 'NSHost' for class message is a forward declaration.
ARC Issue: No known class message for selector 'hostWithName:'
Googling around, I find…

RyanM
- 4,474
- 4
- 37
- 44
0
votes
2 answers
NSHost run in device gives an NSHost.h error
NSHost doesnot support to iphone... When I run this in simulator it works fine... But when I want to run in device means it gives an NSHost.h error....
I want to do this in device also.
How could I fix this?
vinoth