LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

datasocket error

Hi, I am doing some exercises on programming datasocket... (communications between 2 applications....)

I am getting these errors:

 

Undefined symbol '_DS_GetLibraryErrorString@12' referenced in "PROJECT3SEND.C".
Undefined symbol '_DS_GetLastMessage@12' referenced in "PROJECT3SEND.C".

Undefined symbol '_DS_SetDataValue@20' referenced in "PROJECT3SEND.C".

.

.

.

.

 

I have some routines like this:

 

//error checking for datasocket functions
int Checkerror(int error )
{
  if (error <0)   //if problem, display the error message
 {
   DS_GetLibraryErrorString (error, errorBuf, 256);
   SetCtrlVal(WritepanelHandle, WRT_STATUS ,errorBuf);
   return -1;
 }

 return 0;
}

 

 

 

 

Any help?

0 Kudos
Message 1 of 10
(4,194 Views)

Hi,

 

did you add dataskt.fp to your project?

0 Kudos
Message 2 of 10
(4,191 Views)

Yes, dataskt.h is included.

0 Kudos
Message 3 of 10
(4,189 Views)

If I am not mistaken including the .h file is not sufficient, you also should add the .fp file to your project: Edit / Add Files to Project

0 Kudos
Message 4 of 10
(4,183 Views)

It seems that I don'thave this file in the folder. Any idea where to get it from?

0 Kudos
Message 5 of 10
(4,180 Views)

It is supposed to be in the folder toolslib/datasock...

0 Kudos
Message 6 of 10
(4,172 Views)

Sorry but I have a real problem here that I am trying to solve.  I have a separate C program. How do I initiliase my labwindows interface server with a function like this. Note that this function is in a separate C program (it is supposed to be running separately from labwindows interface). What am I supposed to do in my labwindows interface for this to work.

 

Note that my labwindows interface is called PuServer.

 

 

 

int PuServerInit()
{
UINT16 port      = DEFAULT_DB_PORT;
char PU_ServerInet[20];
char ipstr[24];

nvramGetIpStr(ipstr);


/* already socked */
if (PU_SockFd != 0) return 0;


if (strncmp(ipstr,"10.102.",7) == 0)
   strcpy(PU_ServerInet,"10.102.1.1\0");
else
   strcpy(PU_ServerInet,"192.168.2.77\0");

/* create socket */
if ((PU_SockFd = socket (PF_INET,SOCK_STREAM,0)) == DB_ERROR)
    {
        printf ("failed PuServerInit\n");
        PU_SockFd=0;
        return DB_ERROR;
    }


/* connect to server */
PU_SockAddr.sin_family = AF_INET;
PU_SockAddr.sin_port   = htons(port);
PU_SockAddr.sin_addr.s_addr = inet_addr(PU_ServerInet);
bzero (PU_SockAddr.sin_zero, sizeof(PU_SockAddr.sin_zero));

if (connect (PU_SockFd,
            (struct sockaddr *) &PU_SockAddr,
            SOCK_ADDR_SIZE)==DB_ERROR)
    {
        printf ("failed PuServerInit-Connect\n");
        PU_SockFd=0;
        return DB_ERROR;
    }

PU_Peer = 1;

return 0;
}

0 Kudos
Message 7 of 10
(4,170 Views)

I am not sure what version you are using but if it is before CVI 5.5 you can look here for some examples of using sockets.

If you are using CVI later than that there are libraries built in to use sockets, and examples that ship with CVI. If you search the library in CVI for Socket you will find both TCP and UDO sockets, and you can then pull up the functions panel and find the help files and examples for using them.

Jensen
National Instruments
Applications Engineer
0 Kudos
Message 8 of 10
(4,139 Views)

Hi Wolfgang,

 

I try to compile a project that include the recvfrom function, but it always give me a Undefined symbol  '__imp_recvform error. Could you help to tell me which function panel .fp should be added into the project?

0 Kudos
Message 9 of 10
(2,372 Views)

Hi Jason,

 

you should start a new thread for a new question...

This said, the function is part of the win32 api, https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom. So there is no NI function panel, you have to include windows.h, which provides access to the Windows SDK functions.

Message 10 of 10
(2,367 Views)