Re: NSSocketPort == BSD Socket

  • -[NSSocketPort socket] returns a file descriptor. Write to it.

    Init an NSFileHandle with it. (-[NSFileHandle initWithFileDescriptor:])

    It's all just sockets/files/descriptors.

    >
    > But "raw messaging" is not the same as writing raw bytes to a TCP
    > stream. All that means is that you can use the standard NSPort API as
    > well as using it to set up an NSConnection.
    >
    > You say that you've used it to talk to sockets on other platforms.
    > How? The API is completely non-suitable for it. It doesn't give you a
    > way to simply read or write streams. Instead it deals with arrays of
    > messages. This is going to require some sort of custom framing
    > protocol which means that it's not going to be able to talk to
    > anything that doesn't also use that custom framing protocol. How do
    > you get around that limitation?
    >
    > Mike
  • On Thu, Dec 4, 2008 at 7:52 PM, Kirk Kerekes <kkerekes...> wrote:
    > -[NSSocketPort socket] returns a file descriptor. Write to it.
    >
    > Init an NSFileHandle with it. (-[NSFileHandle initWithFileDescriptor:])
    >
    >
    > It's all just sockets/files/descriptors.

    Well, you're not using NSSocketPort to talk to the other app in that
    case. You're using NSSocketPort to create the socket, and then you're
    using a completely different API to actually communicate over it.

    Mike