private void ConnectCallback(IAsyncResult ar)
{
try
{
// Retrieve the socket from the state object.
Socket client = (Socket)ar.AsyncState;
// Complete the connection.
client.EndConnect(ar);
Console.WriteLine("Socket connected to {0}",
client.RemoteEndPoint.ToString());
// Signal that the connection has been made.
connectDone.Set();
}
catch (Exception e)
{
Console.WriteLine("Please check the IP" + e.Message);
int ErrorCode = 10;
string Error = "Please Check the IP";
if (ErrorExcep != null)
ErrorExcep(ErrorCode,Error);
}
}