Hi
Thank you for your help.
I try to implement multiconnection in c++.
As I mentioned before i replaced m_Server with m_ServerArray.
but OnConnected() doesn't have param to check which is connected of 7 servers.
in .Net it has param like
void fmMain_OnConnected(object sender, EventArgs e)
{
int i = GetServerIndex((wclOPPServer)sender);
lbLog.Items.Add("Client " + ((wclOPPServer)sender).Address + " has connected to server " + i.ToString());
}
MFC code I did.
BOOL CBlueChatServerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_API.Load();
m_Radios.InsertColumn(0, L"API", 0, 150);
// __hook(&CwclServer::OnClosed, &m_Server, &CBlueChatServerDlg::OnClosed);
// __hook(&CwclServer::OnConnected, &m_Server, &CBlueChatServerDlg::OnConnected);
// __hook(&CwclServer::OnDisconnected, &m_Server, &CBlueChatServerDlg::OnDisconnected);
// __hook(&CwclServer::OnListen, &m_Server, &CBlueChatServerDlg::OnListen);
// __hook(&CwclServer::OnData, &m_Server, &CBlueChatServerDlg::OnData);
for (int i = 0; i < 7; i ++)
{
__hook(&CwclServer::OnClosed, &(m_ServerArray[i]), &CBlueChatServerDlg::OnClosed);
__hook(&CwclServer::OnConnected, &(m_ServerArray[i]), &CBlueChatServerDlg::OnConnected);
__hook(&CwclServer::OnDisconnected, &(m_ServerArray[i]), &CBlueChatServerDlg::OnDisconnected);
__hook(&CwclServer::OnListen, &(m_ServerArray[i]), &CBlueChatServerDlg::OnListen);
__hook(&CwclServer::OnData, &(m_ServerArray[i]), &CBlueChatServerDlg::OnData);
}
return TRUE; // return TRUE unless you set the focus to a control
}
void CBlueChatServerDlg::OnConnected()
{
//m_Log.InsertString(m_Log.GetCount(), L"Connected: " + m_Server.GetAddress() + m_Server.GetDeviceName());
m_Log.InsertString(m_Log.GetCount(), L"Connected: " + m_ServerArray[0].GetAddress() + m_ServerArray[0].GetDeviceName());
}
How could i know which server of 7 servers receives message from client in MFC version.
Regard.