when closing a TCP socket, DC has at least two methods for doing this.
one is “sock_abort(void *s)” and the other is “sock_close(void *s)”.
I have looked at the function descriptions of these but it is unclear to me why i would choose one over the other. Certainly, there must be a reason to use one over the other or they would have not made 2 functions.
Anyone got an input to why to use one over the other ?
I stand to be corrected but it goes something as follows:
In short, sock_close is the nice way to close the socket, and the closure is communicated to the client/server. If the operation fails, the socket still remains open.
Whereas sock_abort also closes the socket, but even if there is no response from the client/server, the socket will be closed.
In my experience, always use sock_abort.
In my experience, always use sock_abort.
That was my take on it as well.
Thanks