Posts

Post not yet marked as solved
9 Replies
0 Views
Thanks a lot!I must admit I have hard time finding good information on the Network.framework in Swift. I'm using a lot of code I find on GitHub, but I have no guarantee it's properly written.I'll continue implementing my framework, I hope I won't face other issues.
Post not yet marked as solved
9 Replies
0 Views
Hi Eskimo,I've found something strange (in my opinion).I don't receive State changes, but I receive errors on my receive function.I was listening to State changes to handle my connection state but I also have to consider that an error in the receive function means that the connection may be down.It raises new questions:- What errors mean that the connection is down, and what errors mean I should retry my receive? Currently, I'm cancelling the connection any time I get an error, but I may end up with my connections being less resilient than they should.- Do I have to call cancel on both ends to be sure I properly finish the TCP close?
Post not yet marked as solved
9 Replies
0 Views
Hi Eskimo,Thanks for your answer. I've modified a bit my code, and I listen on both ends all the time now.It's better, still, it's a bit weird:- If I cancel a connection, I get the State cancelled on the connection I cancelled, but nothing on the other side. As it's TCP, I should be able to know when a connection is closed.- I get the failed State if I try to send something on the cancelled connection on either end. So, I can work with that, but I have no way to know if a user is disconnected properly or if I have a connection failure somewhere. It's a bit annoying without being blocking.