This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UDP Pointer Problem

Hi everybody,
I have a problem with my UDP communication.
Compiler failure message:
network_api.c:160:83: warning: pointer targets in passing argument 2 of 'recvfrom' differ in signedness [-Wpointer-sign] actDataSize = recvfrom(pObj->clientSocketId, dataBuf, tmpDataSize, 0, (struct sockaddr*)&pObj->addr, &sendsize);

In file included from c:/VISION_SDK_02_06_00_00/vision_sdk/tools/network_tools/build/../common/inc/network_api.h:7:0, from network_api.c:2: c:\vision_sdk_02_06_00_00\ti_components\cg_tools\windows\codeblocks\mingw\include\winsock2.h:548:32: note: expected 'char *' but argument is of type 'UInt8 *'WINSOCK_API_LINKAGE int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*);

Function:

int Network_read(Network_SockObj *pObj, UInt8 *dataBuf, UInt32 *dataSize)
{
    int actDataSize = 0;
    UInt32 tmpDataSize;
    int sendsize = sizeof(pObj->addr);
    tmpDataSize = *dataSize;

    while(tmpDataSize > 0)
    {
        actDataSize = recvfrom(pObj->clientSocketId, dataBuf, tmpDataSize, 0, (struct sockaddr*)&pObj->addr, &sendsize);
                
        if(actDataSize<=0)
        {
            *dataSize = 0;
            return -1;
        }
        dataBuf += actDataSize;
        tmpDataSize -= actDataSize;
    }
    return 0;
}

Struct:

typedef struct {

    SOCKET clientSocketId;
    UInt32 serverPort;
    char ipAddr[32];
    SOCKADDR_IN addr;
    UInt32 protocol;

} Network_SockObj;

  • Hi Benedikt,

    Are you building for Windows? Which device is this?

    I am not familiar with Vision SDK but looking at the error message and the code, it looks like you need pass in char pointer of "databuf" or typecast "databuf" with (char *) in recvfrom().

    If you need more info about Vision SDK you may want to post your question in the device specific forums.

    Vikram