• 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: NSSocketPort vs. AF_UNIX?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSocketPort vs. AF_UNIX?


  • Subject: Re: NSSocketPort vs. AF_UNIX?
  • From: Kaelin Colclasure <email@hidden>
  • Date: Tue, 30 Aug 2005 16:22:47 -0700

On Aug 30, 2005, at 4:09 PM, Tom Harrington wrote:

How can I get an NSSocketPort to use a Unix-domain socket transport?
The docs for NSSocketPort don't specify TCP/IP, only a "BSD socket",
so it would seem that this should be possible.  Only I haven't been
able to get it to work.

On the server side I'm trying to set up the NSSocketPort with
-initWithProtocolFamily:socketType:protocol:address.  So, family
AF_UNIX, check, socketType SOCK_STREAM, check, protocol PF_UNIX,
check.  But "address" is described in the docs as "...family-specific
socket address for the receiver copied into an NSData object".  What's
that?

[...]

I also thought maybe I should set up a struct sockaddr_un, like I was going to work directly with the socket, and then wrap up the struct in an NSData:

    struct sockaddr_un name;
    memset(&name, 0, sizeof(struct sockaddr_un));
    name.sun_family = AF_UNIX;
    strcpy(name.sun_path, "/tmp/af_unix.test");
    int len = sizeof(name.sun_family) + strlen(name.sun_path);

    NSData *addrData = [NSData dataWithBytes:&name length:len];

But that didn't work any better.

Try changing that last line to:

NSData * addrData = [NSData dataWithBytes:&name length:sizeof (name)];

-- Kaelin


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSSocketPort vs. AF_UNIX?
      • From: Tom Harrington <email@hidden>
References: 
 >NSSocketPort vs. AF_UNIX? (From: Tom Harrington <email@hidden>)

  • Prev by Date: Re: Interface Builder Palette error
  • Next by Date: Archiving and NSView Subclasses
  • Previous by thread: NSSocketPort vs. AF_UNIX?
  • Next by thread: Re: NSSocketPort vs. AF_UNIX?
  • Index(es):
    • Date
    • Thread