-
August 28th, 2009, 11:43 PM
#1
invalid socket in thread,
hello every body....
i have some problem wiyh my code. i try to built thread, my code below :
UINT thread(LPVOID p)
{
// variabel dalam kelas thread
char buff[2048];
int s,iSize;
int count, loop = 1, flag=0;
//CString data;
CBServer2View *dlg = (CBServer2View*)AfxGetApp() ->GetMainWnd();
count = dlg -> nClients;
if (count ==-1) loop = 0;
if (loop)
{
s=1;
iSize = sizeof(dlg->sadd_Client);
//dlg->sClient[count] = accept(dlg->sServer, (struct sockaddr *)&(dlg->sadd_Client), &iSize);
dlg->sClient[count] = accept(dlg->sServer, (struct sockaddr *)&(dlg->sadd_Client), &iSize);
if(dlg->sClient[count] == INVALID_SOCKET)
{
AfxMessageBox("Error invalid socket ");
dlg->m_cStartBtn.EnableWindow(TRUE);
return 0;
}
else
{
//
}
}
AfxEndThread(0);
return 0;
}
when i execute my aplication i got message box "Error invalid socket " that mean i got error in accep() function.
is my accept function false? or you have any solutions?
please correct my code... thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|