crash in sendtohelper
Dear Gurus,
I have one super-bug, that I just found
SendTo(data,length,PORT_VIDEO_A,CVideoConfInt::IPtemp1);
will give crash in:
_AFXSOCK_INLINE int CAsyncSocket::SendTo(const void* lpBuf, int
nBufLen, const SOCKADDR* lpSockAddr, int nSockAddrLen, int nFlags)
{ return SendToHelper(lpBuf, nBufLen, lpSockAddr, nSockAddrLen,
nFlags); }
only everytime I call:
(audio send)
//send audio data to server, invoked by record thread //recordsound
void CVideoConfInt::sendMessage(char* mesg, int length)
{
char buflen[30];
char str[PLAYBUFFER+100];
int i,j;
If user not selected or no users are present return;
if(selectflag==0 )
return;
if(mesg==NULL)
{
log.WriteString("\nEmpty buffer received from recordsound");
return;
}
if(length<1 || length>PLAYBUFFER)
{
log.WriteString("\n Send : Length is more than the 2000 or less than
1");
return;
}
mesg=mesg-20;
//First 15 bits contains the destination information
//Next 5 bits contains the length of message
//Remaining part contains the data
if(curuser.IsEmpty())
{
log.WriteString("\n Curuser is Empty- No user selected");
return;
}
for(i=0;i < curuser.GetLength();i++)
mesg[i]=curuser[i];
sprintf_s(buflen,"%d",length);
for(j=0,i=15;j<5;j++,i++)
mesg[i]=buflen[j];
//Write to log file
sprintf_s(str,"\n Sending message datalen = %d , mesg =
%s",length,&mesg[20]);
log.WriteString(str);
if(daudio.Send(mesg,length+20)!=SOCKET_ERROR )
log.WriteString("\n Data sent successfully to "+curuser);
else
log.WriteString("\n Data sent Error ");
return;
}
void CVideoConfInt::startBufferWrite()
{
if(record->recording==FALSE)
{
// if(sockclt.name.CompareNoCase("logname")==0)
record->PostThreadMessage(WM_RECORDSOUND_STARTRECORDING,0,0);
}
}
void CVideoConfInt::stopBufferWrite()
{
if(record->recording==TRUE)
record->PostThreadMessage(WM_RECORDSOUND_STOPRECORDING,0,0);
}
void CVideoConfInt::startBufferPlay()
{
play1->PostThreadMessage(WM_PLAYSOUND_STARTPLAYING,0,0);
play2->PostThreadMessage(WM_PLAYSOUND_STARTPLAYING,0,0);
play3->PostThreadMessage(WM_PLAYSOUND_STARTPLAYING,0,0);
play4->PostThreadMessage(WM_PLAYSOUND_STARTPLAYING,0,0);
}
void CVideoConfInt::stopBufferPlay()
{
play1->PostThreadMessage(WM_PLAYSOUND_STOPPLAYING,0,0);
play2->PostThreadMessage(WM_PLAYSOUND_STOPPLAYING,0,0);
play3->PostThreadMessage(WM_PLAYSOUND_STOPPLAYING,0,0);
play4->PostThreadMessage(WM_PLAYSOUND_STOPPLAYING,0,0);
}
What seems to be the problem since I couldn't find any article related
to it?