Post

Replies

Boosts

Views

Activity

NWConnection ctx.isFinal/isComplete/TCP FIN/TLS close-notify
Say we have a TCP client that: Sends data A, .defaultMessage, isComplete* = true Sends data B, .finalMessage, isComplete* = true (* I assume I have to say true here so it doesn't buffer, while on server isComplete is not true until end of stream; but even if I do isComplete = false here, it doesn't matter) I would expect the server to: Receive data A, ctx.isFinal = false, isComplete = false Receive data B, ctx.isFinal = true, isComplete = true or Receive data A, ctx.isFinal = false, isComplete = false Receive data B, ctx.isFinal = false, isComplete = false Receive nil data, ctx.isFinal = true, isComplete = true ... or A and B split at any other boundary, of course. The actuality is: Receive data A, ctx.isFinal = true, isComplete = false Receive data B, ctx.isFinal = true, isComplete = false Receive nil data, ctx.isFinal = true, isComplete = true Why is isFinal always true? But okay, whatever, I can just rely on isComplete. However, then I turn on TLS, and the result is: Receive data A, ctx.isFinal = true, isComplete = false Receive data B, ctx.isFinal = true, isComplete = false ... crickets ... How am I supposed to know the client has EOF'd? Does Network.framework not sent TLS close-notify? I realize I can cancel() the entire connection on the client, and then I get isComplete = true, but I want to close just one half of the stream; the server still needs to send its response. Code - https://developer.apple.com/forums/content/attachment/e2b353fd-dc15-4520-907c-6fea43e9c9af
14
0
1.5k
Feb ’21