Thanks for your reply. The server receives nothing, none of the protocol has its handleInput() method called. Here are the logs:
# Client
Protocol1 start()
Protocol2 start()
sending 2990 bytes
Protocol2 handleOutput()
# Server
Protocol1 start()
Protocol2 start()
Protocol1 is placed at index 1, Protocol2 is on top at index 0. Instead I would expect this to happen:
# Client
Protocol1 start()
Protocol2 start()
sending 2990 bytes
Protocol2 handleOutput()
Protocol1 handleOutput()
# Server
Protocol1 start()
Protocol2 start()
Protocol1 handleInput()
Protocol2 handleInput()
received 2990 bytes
I insert the protocols on the NWListener (server-side) and the NWConnection (client-side) like so:
let protocol1 = NWProtocolFramer.Options(definition: Protocol1.definition)
let protocol2 = NWProtocolFramer.Options(definition: Protocol2.definition)
let parameters: NWParameters = .tcp
parameters.defaultProtocolStack.applicationProtocols.insert(protocol1, at: 0)
parameters.defaultProtocolStack.applicationProtocols.insert(protocol2, at: 0)