i do something like that before so i will give u the steps :-
first u need method to detect the disconnected connection as
Code:
Agent_buffer.Size = Agent_socket.Receive(Agent_buffer.Buffer, 0, Agent_buffer.Buffer.Length, SocketFlags.None, out err);
if (Agent_buffer.Size == 0)
{
Reconnect();
}
second u need to pause the main thread while reconnecting ,that rly depend on your code ,
u can use
ManualResetEvent for that just google for it
last u need to try establish a new connection and resume the main thread after the character login in the world map .
BTW :- dont forget to dipose the disconnected socket .