ISockPort RecvFrom回调不起作用
nntt 2009-09-17 09:03:03 void x_OpenSockport( CBCMCS* pMe )
{
if( ISHELL_CreateInstance( pMe->a.m_pIShell, AEECLSID_SOCKPORT, (void **)(&pMe->ptrSockport) ) != SUCCESS )
{
x_DrawStatus( pMe, pMe->nStatusCurrentLine + 4, " Cr Sockport Failed!" );
return;
}
if ( ISOCKPORT_OpenEx( pMe->ptrSockport, AEE_AF_INET, AEE_SOCKPORT_DGRAM, 0 ) != SUCCESS )
{
x_DrawStatus( pMe, pMe->nStatusCurrentLine + 4, " Op Sockport Failed!" );
return;
}
x_SetupNetWork( pMe );
}
void x_SetupNetWork( void* ptrUser )
{
CBCMCS* pMe = (CBCMCS*)ptrUser;
int nRet = SUCCESS;
nRet = ISOCKPORT_Bind( pMe->ptrSockport, (void*)&pMe->groupAddr );
switch( nRet )
{
case AEEPORT_WAIT:
x_DrawStatus( pMe, pMe->nStatusCurrentLine + 5, " Still Setup Net!" );
ISOCKPORT_WriteableEx( pMe->ptrSockport, &(pMe->cbLookup), (PFNNOTIFY)x_SetupNetWork, pMe );
break;
case AEE_NET_SUCCESS:
x_DrawStatus( pMe, pMe->nStatusCurrentLine + 5, " Setup Net Success!" );
x_ReadInData( ptrUser );
break;
default:
CALLBACK_Cancel( &(pMe->cbLookup) );
x_DrawStatus( pMe, pMe->nStatusCurrentLine + 5, " Setup NetFailed!" );
break;
}
}
void x_ReadInData( void* ptrUser )
{
CBCMCS* pMe = (CBCMCS*)ptrUser;
int nRet = SUCCESS;
char* buffer = NULL;
AEESockAddrStorage srcAddr;
int addrSize = sizeof( AEESockAddrInet );
buffer = MALLOC( 1024 );
nRet = ISOCKPORT_RecvFrom( pMe->ptrSockport,
buffer,
64,
0,
&srcAddr, &addrSize );
if ( nRet < 0 )
{
x_DrawStatus( pMe, pMe->nStatusCurrentLine + 6, " Read Failed!" );
}
else
{
x_DrawStatus( pMe, pMe->nStatusCurrentLine + 5, "Read Success!" );
}
if ( buffer )
{
FREE( buffer );
buffer = NULL;
}
ISOCKPORT_ReadableEx( pMe->ptrSockport, &(pMe->cbLookup), (PFNNOTIFY)x_ReadInData, pMe );
}
为什么x_ReadInData只调用一次,回调没有用啊,我想一直读取,看看代码错在哪