//*************************************
public bool Join_Swarm(string DstIP, string DstPort,string SrcIP, string SrcPort,string Username)
{
Thread t1 = null;
Thread t2 = null;
try
{
t1 = new Thread(new ThreadStart(mSocket.StartListening));
t1.Start();
t1.IsBackground = true;
string cpu = "1";
mSocket.SetIP(SrcIP);
mSocket.SetPort(SrcPort);
mSocket.SetName(Username);
mSocket.SetCPU(cpu);
MessageGenerator msg = new MessageGenerator();
string mMsg = msg.msgConnectionRequest
(mSocket.GetIP(), mSocket.GetPort(), mSocket.GetName(), mSocket.GetCPU());
AsynchronousClient client = new AsynchronousClient();
client.SetSingleMsg(DstIP, DstPort, mMsg);
t2 = new Thread(new ThreadStart(client.SendSingleClient));
t2.Start();
t2.IsBackground = true;
return true;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
return false;
}
}