Click here to Skip to main content
15,393,377 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
UINT CLGD_DL_INSPECTIONDlg::OnThreadComm(LPVOID pParam)
{	

    CLGD_DL_INSPECTIONDlg *ImgCopyThread = (CLGD_DL_INSPECTIONDlg *)pParam;

	CClientSocket *m_pServiceSocket = new CClientSocket();

	ResultMessage.Format("PCB_RESULT,%s_%s,NG\r\n", Param.ModelID, PCBImageNameVal);


    ImgCopyThread->SendMessageList[i].Format("%s", ResultMessage);
    ImgCopyThread->SendMessageList[i]->SetString((LPCSTR)ResultMessage);
	m_pServiceSocket->Send(ResultMessage, (int)strlen(ResultMessage));
	ImgCopyThread->m_Socket.Send(ResultMessage,(int)strlen(ResultMessage));
	m_pServiceSocket->Send(ResultMessage, (int)strlen(ResultMessage));
	    ImgCopyThread->Send_Message(ResultMessage, i);
}


void CLGD_DL_INSPECTIONDlg::Send_Message(CString Message, int i)
{
//	m_pServiceSocket = new CClientSocket();
	m_pServiceSocket = new CClientSocket(this);

	SendMessageList[i] = new CString();
	*SendMessageList[i] = Message;


	m_pServiceSocket->Send(SendMessageList[i]->GetString(), (int)strlen(SendMessageList[i]->GetString()));
}

bool CLGD_DL_INSPECTIONDlg::ProcessConnect()
{
//	m_pServiceSocket->Create();
//	m_pServiceSocket = new CClientSocket();
	m_Socket.Create();

	if (m_Socket.Connect("127.0.0.1", 8000) == FALSE) // 서버 연결 실패하면 프로그램 종료한다.
	{
		PostQuitMessage(0);
		return FALSE;
	}
	else 
	{
		return TRUE;
	}
}


What I have tried:

it is not work all Error

i don't know how to solve..

if you have example to Use Socket Send in Thread , show me please.. Thank you
Posted
Updated 5-Nov-21 18:54pm
v2
Comments
Rick York 6-Nov-21 0:57am
   
I recommend that have you a look at the Related Questions list on the right of this page. Also consider searching this site for articles on the topic of sockets. There are a good number of them.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900