• 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
Re: port number for NSSocketPort
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: port number for NSSocketPort


  • Subject: Re: port number for NSSocketPort
  • From: j o a r <email@hidden>
  • Date: Thu, 29 May 2003 11:08:44 +0200

On Thursday, May 29, 2003, at 05:14 Europe/Stockholm, Lloyd Dupont wrote:

I'm using DO over the network using NSSocketPort
I init a [myNSSocketPort initWithTcpPort:0], so a port is chosen for me.
however I do need to know the port to register my object with Rendezvous

how could I know the port number of my NSSocketPort ?

Perhaps this will work:

#import <netinet/in.h>
#include <arpa/inet.h>

{
struct sockaddr_in addrIn = *(struct sockaddr_in *)[[myNSSocketPort address] bytes];
NSLog(@"Port: %d", addrIn.sin_port);
}

Hacked together in mail, so I'm not sure it works - but it could be worth a try.
Why don't you just pick a port number youself?

j o a r
_______________________________________________
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:
    • Re: port number for NSSocketPort
      • From: Lloyd Dupont <email@hidden>
References: 
 >port number for NSSocketPort (From: Lloyd Dupont <email@hidden>)

  • Prev by Date: Sub/Superscripts with NSButton
  • Next by Date: Re: Getting Application Path
  • Previous by thread: port number for NSSocketPort
  • Next by thread: Re: port number for NSSocketPort
  • Index(es):
    • Date
    • Thread