Have your Connect method create a new socket and return that socket to send data. Something more like:
try
{
CCMSocket = new Socket();
CCMSocket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
CCMSocket.Connect(CCMServer, CCMPort);
return CCMSocket
}
and
do
{
reconnectCounter++;
Disconnect(); //<-- Just CCMSocket.Disconnect(true) in a try/catch
var newSocket = Connect(CCMServer, CCMPort); // <-- method given above
if (newSocket != null)
{
connected = true;
newSocket.Send(LoginData); // should work
CCMSocket = newSocket; // To make sure existing references work
}
} while (!connected);
You should also seriously consider the asynchronous socket pattern when building server applications.