Is this how Apple's security works?

My Swift-NIO app is running fine on my 27" iMac, so I copied it over to a MacBook Air to test it there. When I ask it to connect to the same server on my LAN, nothing happens. It doesn't connect. At the very least I expected macOS to throw up a pop-up asking for a password. No error message or any help whatsoever. Is this normal and where do I go from here?

How do you set up the ServerBootstrap?

Hi Corry,

I have this, so what am I missing?

let group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)

let bootstrap = ServerBootstrap(group: group)
    // Specify backlog and enable SO_REUSEADDR for the server itself
    .serverChannelOption(ChannelOptions.backlog, value: 256)
    .serverChannelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
    
    // Set the handlers that are appled to the accepted Channels
    .childChannelInitializer { channel in
        // Ensure we don't read faster than we can write by adding the BackPressureHandler into the pipeline.
        channel.pipeline.addHandler(BackPressureHandler()).flatMap { v in
            channel.pipeline.addHandler(RequestHandler())
        }
    }
    
    // Enable SO_REUSEADDR for the accepted Channels
    .childChannelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
    .childChannelOption(ChannelOptions.maxMessagesPerRead, value: 16)
    .childChannelOption(ChannelOptions.recvAllocator, value: AdaptiveRecvByteBufferAllocator())

defer {
    try! group.syncShutdownGracefully()
}

let channel = try bootstrap.bind(host: host, port: port).wait()

What's the value of host?

rp64lite.local

Have you tried using 0.0.0.0 to bind to all interfaces?

Sorry. The Server runs as "0.0.0.0" and the client as "rp64lite.local". The server is on a Raspberry Pi. The client runs within Xcode (debug mode) on my iMac.

Oh, I'm sorry, you copied the client over? What happens when you run the client? Does it run successfully? Do you get errors? Does it hang?

The client on the PowerBook, just the App with no Xcode installed, runs without error on the PowerBook, but when I click the Connect button it doesn't connect. It doesn't hang, crash or emit any error messages,

In your terminal can you run ping rp64lite.local and show me the output?

Yes it pings OK.

Can you use nc rp64lite.local <your port number here> and try typing in the resulting window to see if your server accepts the connection?

1 Like

I'll have to get back to you later, because (since I discovered the problem) I've been modifying the API so my server app is unable to run at this time. I'll do the nc thing a.s.a.p..

nc rp64Lite.local 9999 makes the channel to go active (and inactive when nc exits. Your help has led me to discover where the problem is. It's because the @AppStorage settings are not being read (or written) and that's where the IP and port are defined. I only noticed this because another preference setting was only showing an @ sign instead of what should be on the screen.

I'm inclined to think I don't know much about bundle permissions. This is the first time I've ever moved one of my apps to another machine that doesn't know about me. The PowerBook belongs to my wife.

Terms of Service

Privacy Policy

Cookie Policy