SMBServer v1.0.5

This commit is contained in:
Tal Aloni 2016-12-22 20:51:16 +02:00
parent b75820452d
commit bd1006cb81
400 changed files with 28062 additions and 0 deletions

View file

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace Utilities
{
public class SocketUtils
{
/// <summary>
/// Socket will be forcefully closed, all pending data will be ignored, and socket will be deallocated.
/// </summary>
public static void ReleaseSocket(Socket socket)
{
if (socket != null)
{
if (socket.Connected)
{
socket.Shutdown(SocketShutdown.Both);
try
{
socket.Disconnect(false);
}
catch (SocketException)
{ }
}
socket.Close();
socket = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}
}