public void Send_ChatMsg(string chatMsg, string Username)
{
try
{
Thread t = null;
MessageGenerator mMsg = new MessageGenerator();
//Chat username to be included
string msg = mMsg.msgChat(chatMsg, mSocket.GetIP() + ":" + mSocket.GetPort());
AsynchronousClient client = new AsynchronousClient();
client.SetMultiMsg(mSocket.GetIPtoPeer(), msg, mSocket.GetIP() + ":" + mSocket.GetPort());
t = new Thread(new ThreadStart(client.SendMultiClientChat));
t.IsBackground = true;
t.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Failed to send chat message.");
}
}