Post

Replies

Boosts

Views

Activity

Using two network protocol framer in the protocols stack
Hello, I wrote a server and client using the Network framework and added the same protocol framer on both sides. It seems to work just fine. But then I wanted to add another protocol framer in the stack and things stop working. I can see that both protocols are started but for some reason the protocol at index 1 does not receive output on the client side and the server receives nothing. For purpose of testing I have simply duplicated and renamed the first protocol (which I know worked by itself) in order to create the second protocol. So I am not sure what's going on here. Any idea?
3
0
743
Jul ’21
Exchange information with a network protocol framer
I need to provide information from my application to my network protocol framer to be used during the handshake but cannot find a way to do this. I'm not sending any message yet so cannot use NWProtocolFramer.Message. Is there any way to do this? I'm also looking for a way to provide information obtained during the handshake back to the application, ideally I would be able to attach such information to the connection itself so it can be retrieved later by the application. Only way I can think of for now is calling framer.deliverInput() during the handshake to deliver a fake message but that doesn't sound great. Is there a better way? I would love if there was some sort of storage attached to the connection itself that could be used to exchange information between the application and the protocol framer.
5
0
874
Jul ’21
Network protocol framer and receiving partial messages
It was my understanding that the protocol framer would accumulate data until it is consumed, which I would do by returning a non-zero value from the framer.parseInput() block or by calling deliverInputNoCopy(). However it does not seem to be the case, at least not across severals calls to handleInput(). Per my testing, I am unable to parse the needed amount of data across several calls to handleInput(). Is it correct that the non-consumed data is dropped between calls to handleInput() and our implementations need to take care to accumulate partial data across several handleInput() calls? And if it is correct, I'm also quite confused by the TicTacToe sample code because it does not seem to worry about receiving a partial header. Is this a bug in the sample code?
4
0
782
Jul ’21
NWConnection send buffer and when to send more data
It was my understanding that it is ok to blindly send more data from the completion handler of the connection send() method. I've been testing this and the connection will enqueue enormous amount of data in-memory (gigabytes) and still happily call the completion handler for more. Seems like this is not the way to go, but then, how would I know when it is ok to send more data on the connection?
16
0
4.0k
Aug ’21
SwiftUI app cycle and opening an app document
I am writing a SwiftUI app cycle macOS app and trying to open a custom app document. I have added the appropriate entries to the Info.plist file and the document does open in my app. I am using NSApplicationDelegateAdaptor to provide an application delegate. The application(_ application: NSApplication, open urls: [URL]) app delegate method does get called but urls is an empty array. Furthermore an additional app window opens when opening my document. My app is not a document based app and my custom document is not associated with a class or an NSDocument thing. Is this broken in SwiftUI app cycle based apps or am I missing something? Is there a solution?
1
0
961
Sep ’21
Is there a way to get the built-in list of anchor certificates from the OS?
I am looking for a way to get the immutable list of anchor certificates from the OS. The aim would be to pass this list to SecTrustSetAnchorCertificates() in order to fail validation in case of man-in-the-middle attacks via a trusted certificate added to the keychain. This would hit a middle ground between doing nothing and doing full certificate pinning. Is there a way to achieve this?
8
0
944
Mar ’23
Core Image drawing corruption
I have written two custom Core Image metal kernels which I'm using to produce a CIImage (by chaining several filters). I'm drawing the output image in a simple view and whatever I use (CIImage, NSImage, CGImageRef), the image appears corrupted on screen, like some sort of graphics corruption (I've tried on two different machines with different systems). However if I add a simple step to write the image to disk from the CIImage then read it from disk and draw it in that very same view, then all is fine and the image appears correctly. What could possibly be happening here?
7
0
1.1k
Jul ’23