mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 06:01:12 +00:00
fixed a lot of jank. created a utils file and removed unused files
This commit is contained in:
@@ -8,10 +8,6 @@
|
||||
|
||||
#import "Computer.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
|
||||
@implementation Computer
|
||||
|
||||
- (id) initWithHost:(NSNetService *)host {
|
||||
@@ -23,33 +19,4 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (int) resolveHost
|
||||
{
|
||||
struct hostent *hostent;
|
||||
|
||||
if (inet_addr([self.hostName UTF8String]) != INADDR_NONE)
|
||||
{
|
||||
// Already an IP address
|
||||
int addr = inet_addr([self.hostName UTF8String]);
|
||||
NSLog(@"host address: %d", addr);
|
||||
return addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
hostent = gethostbyname([self.hostName UTF8String]);
|
||||
if (hostent != NULL)
|
||||
{
|
||||
char* ipstr = inet_ntoa(*(struct in_addr*)hostent->h_addr_list[0]);
|
||||
NSLog(@"Resolved %@ -> %s", self.hostName, ipstr);
|
||||
int addr = inet_addr(ipstr);
|
||||
NSLog(@"host address: %d", addr);
|
||||
return addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to resolve host: %d", h_errno);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user