Receive will throw exception if the connect is disconnected?

mc 4,111 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,647 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,400 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful