The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   Omni Frameworks (http://forums.omnigroup.com/forumdisplay.php?f=16)
-   -   OmniNetworking Problem (http://forums.omnigroup.com/showthread.php?t=20616)

tageborg 2011-04-05 01:26 PM

OmniNetworking Problem
 
Hello,

Disclaimer: it has been years since I tried programming for OS X the last time.

Now, I just cannot manage to get OmniNetworking working. The sample code in OmniNetworking/Examples/TCPTest/ compiles fine (after creating a new .xcodeproj, the .pbproj project file is reported to be incompatible with my App Store-purchased XCode). However, when running the resulting binary with the -receive flag and a port (over 1024), it throws an exception: ONHostHasNoAddressesExceptionName. I have nailed this down to ONHost.m line 333:

[CODE]NSString *lowercaseHostname = [aHostname lowercaseString];[/CODE]

where aHostName suddenly has an invalid address... That variable was just fine before trying to find the host name it contained in the hostCache.

A smaller example that is non-working in the same way is:

[CODE]#import <Foundation/Foundation.h>
#import <OmniBase/OmniBase.h>
#import <OmniNetworking/OmniNetworking.h>

int main (int argc, const char * argv[])
{

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *hostName;
unsigned short hostPort;
ONHost *host;

hostName = [[NSString alloc] initWithString: [ONHost localHostname]];

hostPort = 2357;

host = [ONHost hostForHostname:hostName]; // exception thrown here
if (![[host addresses] count]) {
fprintf(stderr, "Cannot determine an address for %s\n", argv[2]);
exit(1);
}

[hostName release];
[pool drain];
exit(0);
return 0;
}[/CODE]

Can somebody help me out here? What am I doing wrong?


All times are GMT -8. The time now is 04:00 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.