mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-26 02:38:15 +02:00
Improved ReleaseSocket implementation
This commit is contained in:
parent
b6280748c1
commit
3674fcd58a
1 changed files with 4 additions and 5 deletions
|
@ -34,7 +34,7 @@ namespace Utilities
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Socket will be forcefully closed, all pending data will be ignored, and socket will be deallocated.
|
||||
/// Socket will be forcefully closed and all pending data will be ignored.
|
||||
/// </summary>
|
||||
public static void ReleaseSocket(Socket socket)
|
||||
{
|
||||
|
@ -52,12 +52,11 @@ namespace Utilities
|
|||
return;
|
||||
}
|
||||
catch (SocketException)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
}
|
||||
// Closing socket closes the connection, and Close is a wrapper-method around Dispose.
|
||||
socket.Close();
|
||||
socket = null;
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue