Simple question that may or may not be programming related. I'm a mechanical engineering student so I'm trying to be as clear as I can here. This list entry may be a duplicate as the first attempt exceeded 25k in size.

It seems NSConnection will return a proxy object but only when both "ends" are on the same machine, over a network, it will "hang". The application can quit and other buttons and returns nil.

Here is some of the console output for the client.

2008-07-18 03:32:05.149 YANA-Client[4569:10b] [NSPortCoder sendBeforeTime:sendReplyPort:] timed out (10238055525.147535 238055525.148441) 1

We've attempted to go through the firewall(s) using System Preferences with no success. What I did notice was that when I used the sendPort method from the NSConnection we saw that the port types were Mach- based and from the ADC documentation it seems to indicate that these ports are internal to the OS and inaccessible remotely. Anyway to "force" the port types to be non-Mach? I have not seen anything in the API to indicate it.

I have used sockets before (years ago) and when I tried to replicate previous successes, but the very presence of the accept() command immediately freezes my client. Right now, the idea of using these objects is a HECK of a lot more appropriate for our application (by far).

Here is the code for the client application (which has been cut down to avoid this list's 25k size limit):

@implementation ClientController

unsigned short assignedPort;
NSConnection *connection;
NSSocketPort *port;
NSString *hostName;
NSProxy *remoteObject;


-(void)awakeFromNib
        {
        assignedPort = [portField intValue];
port = [[NSSocketPort alloc] initRemoteWithTCPPort:assignedPort host: [hostField stringValue] ]; connection = [[NSConnection connectionWithReceivePort:nil sendPort:port] retain];
        remoteObject = [[connection rootProxy] retain];                 
        }


- (IBAction)sendMessage:(id)sender
        {
        NSLog([rootProxy myMethod:@"Testing"]);
        }
@end


-------------------

@implementation ServerController

// Globals same as above

-(void)awakeFromNib
        {
        assignedPort = [portField intValue];
        port = [[NSSocketPort alloc] initWithTCPPort:assignedPort];
connection = [[NSConnection alloc] initWithReceivePort:port sendPort:nil];
                
        [connection setRootObject:self];                
        }

-(NSString *) myMethod:(NSString *)inboundMessage
        {
        NSLog(inboundMessage]);
        return @"Received.\n";
        }

@end


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to