if (m_pCSocSend=new CSocSend (this))
{
If (m_pCSocSend - & gt; Create ())//Create a socket
{
If (m_pCSocSend - & gt; Connect (I, 1000))//the server name, port number
{
M_pCSocSend - & gt; M_pCSocFile=new CSocketFile (m_pCSocSend);
M_pCSocSend - & gt; M_pCArcIn=new CArchive (m_pCSocSend - & gt; M_pCSocFile CArchive: : load);
M_pCSocSend - & gt; M_pCArcOut=new CArchive (m_pCSocSend - & gt; M_pCSocFile CArchive: : store);
M_lst_log. AddString (" connection is successful, can start message!" );
M_btn_send. EnableWindow (TRUE);
}
The else
{
M_lst_log. AddString (" connection is not successful!" );
The delete m_pCSocSend;//remove the socket of memory
}
The first button:
void CSocCltDlg: : OnButton1 ()could you please tell me, why don't have to enter the IP address in the first edit box can connect a success?
{
//TODO: Add your the control notification handler code here
GetDlgItem (IDC_EDIT1) - & gt; GetWindowText (I);
MessageBox (I);
}
CodePudding user response:
May write dead,CodePudding user response: