我要发送的数据是一个void*的数据块,我这样发送send(soc,(char*)pbData,len,MSG_OOB);返回错,错误代码10053,请问我改怎么写send的第2,3个参数才对?

解决方案 »

  1.   

    晕,10053与LVOID 有何关系?
      

  2.   

    MSG_OOB ? 为什么要这样发
      

  3.   

    因为是流数据所以用了 MSG_OOB to DentistryDoctor(牙医的目标是没有蛀牙) ( ) 
    如果我填入一个已知得字符串如char *test=“this is a test”,这样发送send(soc,test,15,MSG_OOB);则为ok,所以我觉得可能是我的参数没有给对。
      

  4.   

    关键你要知道为什么返回10053
    #define WSAECONNABORTED         (WSABASEERR+53)  //10053
    The virtual circuit was terminated due to a time-out or other failure. The application should close the socket as it is no longer usable.
    您的主机中的软件放弃了一个已建立的连接。
      

  5.   

    这是一个从directsound取得数据然后发送到网络客户端得函数,现在就是发送得数据有问题,我猜测可能是send得参数有问题BOOL  RecordCapturedData(SOCKET soc) 
    {
        HRESULT hr;
        VOID*   pbCaptureData    = NULL;
        DWORD   dwCaptureLength;
        VOID*   pbCaptureData2   = NULL;
        DWORD   dwCaptureLength2;
        DWORD   dwReadPos;    LONG lLockSize;
    UINT    dwDataWrote;
    memset(CaptureData,0,sizeof(CaptureData));
    TCHAR szError[100];
        if( NULL == g_pDSBCapture )
            return S_FALSE;    if( FAILED( hr = g_pDSBCapture->GetCurrentPosition( &dwCapturePos, &dwReadPos ) ) )
            return DXTRACE_ERR_MSGBOX( TEXT("GetCurrentPosition"), hr );    lLockSize = dwReadPos - g_dwNextCaptureOffset;
        if( lLockSize < 0 )
            lLockSize += g_dwCaptureBufferSize;    // Block align lock size so that we are always write on a boundary
        lLockSize -= (lLockSize % g_dwNotifySize);    if( lLockSize == 0 )
            return S_FALSE;  // Lock the capture buffer down
    g_pDSBCapture->Lock(g_dwNextCaptureOffset,lLockSize,&pbCaptureData,&dwCaptureLength, &pbCaptureData2, &dwCaptureLength2, 0L);
    int sendlength=send(soc,(char*)pbCaptureData,dwCaptureLength,MSG_OOB);
    if(sendlength== SOCKET_ERROR)
        {
    wsprintf (szError, TEXT("Sending data to the client failed. Error: %d"),WSAGetLastError ());
    return 1;
    MessageBox (NULL, szError, TEXT("Error"), MB_OK);
    }    // Move the capture offset along
     
        g_dwNextCaptureOffset += dwCaptureLength; 
        g_dwNextCaptureOffset %= g_dwCaptureBufferSize; // Circular buffer
        if( pbCaptureData2 != NULL )
        {
    //////////////////
    sendlength=send(soc,(char*)pbCaptureData2,dwDataWrote,MSG_OOB);
    if(sendlength==SOCKET_ERROR)
    {
    wsprintf (szError, TEXT("Sending data to the client failed. Error: %d"),WSAGetLastError ());
    MessageBox (NULL, szError, TEXT("Error"), MB_OK);
    }        // Move the capture offset along
            g_dwNextCaptureOffset += dwCaptureLength2; 
            g_dwNextCaptureOffset %= g_dwCaptureBufferSize; // Circular buffer
        }
        // Unlock the capture buffer
        g_pDSBCapture->Unlock( pbCaptureData,dwCaptureLength, pbCaptureData2, dwCaptureLength2 );
    return 0;
    }
      

  6.   

    send参数得问题,如果我这样
    char *test=“this is a test”;
    send(soc,test,15,MSG_OOB);
    则为ok,所以我觉得可能是我的参数没有给对。
      

  7.   

    MSG_OOB?????????这个参数有什么意义???去掉试试.
      

  8.   

    会不会是pbData中有字节为\0?
    这样的话转为char *类型发送时,遇到\0就会认为字符串结束?
      

  9.   

    前两个参数出错的可能性比较大,请确认:   soc与pbData是否有效
      

  10.   

    知道为什么会报 哪个错了,socket参数传的有问题。
      

  11.   

    pbData len 怎么得到的???