public virtual void Close()
{
StopListener();
if (Client != null && !m_IsClosed)
{
try
{
Client.Shutdown(SocketShutdown.Both);
}
catch (Exception e)
{
m_Session.Logger.Error(e);
}
try
{
Client.Close();
}
catch (Exception e)
{
m_Session.Logger.Error(e);
}
finally
{
Client = null;
m_Session = null;
m_IsClosed = true;
OnClose();
}
}
}