Hi all,

I've started working on an implementation of (NS)NetService (https://github.com/Bouke/NetService), in pure Swift. My goal is to stay close to the version in Cocoa. While I've got an intial working version, I've hit a snag. When publishing a NetService, you can also listen for connections for that service:

let ns = NetService(domain: "local.", type: "_airplay._tcp.", name: "demo", port: 7000)
ns.publish(options: [.listenForConnections])

The NetService's delegate has  a method for accepting connections:

   func netService(_ sender: NetService,
                   didAcceptConnectionWith inputStream: InputStream,
                   outputStream: OutputStream)

I've setup a CFSocket for listening and inside the accept callback it creates a CFReadStream and a CFWriteStream using CFStreamCreatePairWithSocket. The problem is that CFNetwork is not available on Linux and probably will never be. So CFStreamCreatePairWithSocket is not available.

So the question is; how to create InputStream and OutputStream inside the accept callback without CFNetwork?

--
-Bouke
_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

Reply via email to