Correct way to use NWConnection for long-running TCP socket

前端 未结 1 357
失恋的感觉
失恋的感觉 2021-01-14 02:14

I\'ve been fighting with NWConnection to receive data on a long-running TCP socket all day. I\'ve finally got it working after inflicting the following errors on myself due

相关标签:
1条回答
  • 2021-01-14 02:57

    I think you can use a short time connection many times. For example a client connects to the host and asks the host to do something and then tells the host to shutdown the connection. The host switches to the waiting mode to ready a new connection. See the diagram below.

    You should have the connection timer to shutdown opened connection when the client don't send the close connection or answer event to the host for a particular time.

    0 讨论(0)
提交回复
热议问题