Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I'm writing exception handling around a call to Socket.AcceptAsync in a loop. One of the exceptions it's documented to throw is SocketException, but the documentation is vague: An error occurred...
#1: Initial revision
Does Socket.AcceptAsync throw SocketException for any transient reason?
I'm writing exception handling around a call to [`Socket.AcceptAsync`](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.acceptasync?view=net-8.0#system-net-sockets-socket-acceptasync(system-threading-cancellationtoken)) in a loop. One of the exceptions it's documented to throw is `SocketException`, but the documentation is vague: >An error occurred when attempting to access the socket. I want to know if `AcceptAsync` throws `SocketException` for any transient reason. In particular, is there anything the remote client could do to cause it to throw? If I don't account for this, my program could be subject to denial of service attacks.