Receive will throw exception if the connect is disconnected?

mc 3,866 Reputation points
2023-11-10T00:53:54.8233333+00:00

if(socket.Connected)

{

socket.Send(buffer);

}

if the client is closed or disconnected socket.Send will throw an exception .how to avoid this?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,525 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,283 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful