• 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
DO Client can't connect, problem with code or Airport firewall?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DO Client can't connect, problem with code or Airport firewall?


  • Subject: DO Client can't connect, problem with code or Airport firewall?
  • From: Drew Cunningham <email@hidden>
  • Date: Tue, 23 Apr 2002 04:23:31 -0400

Could someone look at my DO code? It's simpler than it looks, half of it is comments and error checking. The client portion can't seem to connect, and I don't know if it is my code, or the fact that the network is through Airport. Thanks in advance!


// set up port stuff
NSPort *localPort, *transferPort;
unsigned short portAddress = 1331;
localPort = [[NSSocketPort alloc] init];

// Set up shared data object for client or server depending on radio button state
if( [clientCell state] == NSOnState ) // in case of client
{
// set up transfer port
IPAddress = [NSString stringWithFormat:@"%d.%d.%d.%d",
[[[addressFields cells] objectAtIndex:0] intValue],
[[[addressFields cells] objectAtIndex:1] intValue],
[[[addressFields cells] objectAtIndex:2] intValue],
[[[addressFields cells] objectAtIndex:3] intValue]]; // Forms IP address from text fields
NSLog(@"IP Address: %@", IPAddress);
transferPort = [[NSSocketPort alloc] initRemoteWithTCPPort:portAddress host:IPAddress];
if( ! transferPort )
NSLog(@"can't setup tcp port %hd", portAddress);

// open connection
theConnection = [NSConnection connectionWithReceivePort:localPort sendPort:transferPort]; // Ports switched from host
if( !theConnection )
NSLog(@"Failed to create connection\n");
sharedData = [[theConnection rootProxy] retain];
if( !sharedData )
NSLog(@"Failed to get shared data object\n");
else
NSLog(@"share data object:%@",sharedData);
}
else // in case of server
{
// set up transfer port
transferPort = [[NSSocketPort alloc] initWithTCPPort:portAddress];
if( ! transferPort )
NSLog(@"can't setup tcp port %hd", portAddress);

// open connection
sharedData = [[SharedDataObject alloc] init];
theConnection = [[NSConnection alloc] initWithReceivePort:transferPort sendPort:nil];
if( ! theConnection )
NSLog(@"could not alloc/init connection");
[theConnection setRootObject:sharedData];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • IPv6 is coming -- watch your use of IP addresses
      • From: Chris Kane <email@hidden>
  • Prev by Date: Re: "Space" key equivalent for menu items
  • Next by Date: [ANN] FoundationCollectionsPalette v1.0.0
  • Previous by thread: app responding to a click on a link
  • Next by thread: IPv6 is coming -- watch your use of IP addresses
  • Index(es):
    • Date
    • Thread