LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Cleaning UDP port

Hi,

I wanted to ask, do you know if there is any command for UDP Port that removes all characters from the input queue of the specified port?

For the RS232 serial port, it is the "FlushInQ" command from the "FlushOutQ" input and output.

 

I have a problem with taking logs 10 times per second over the UDP line and now I receive them 100 times per second and the program starts to crash rapidly.

 

I think it's a buffer overflow, but chy may be elsewhere.

Thank you for answer

 

Have a nice day

0 Kudos
Message 1 of 4
(2,342 Views)

Hello,

 

Have you sen this form?

The topic is not directly matching this one but still may be helpful.

__________________________________________
The best way to thank, is to give KUDOS
0 Kudos
Message 2 of 4
(2,246 Views)

Hello,

thank you for answer.

Logically, it could work, increase the cache.

Unfortunately, I did not find the mentioned register to increase the memory.

Thanks for the help

 

My data reception code:

 

int CVICALLBACK UDPCallback (unsigned channel, int eventType, int errCode, void *callbackData)
{
int error = 0,size;
unsigned char *msg = NULL;
//static int Citac=0;

if (eventType == UDP_DATAREADY)
{
char srcAddr[16];
unsigned int srcPort;
char msgSourceString[16 + 10];
int i;

// Pass NULL as the input buffer to determine the size of the arrived data.
errChk (size = UDPRead(channel, NULL, 0, UDP_DO_NOT_WAIT, NULL, NULL));

nullChk (msg = malloc(size));

// Read the waiting message into the allocated buffer.
errChk (size = UDPRead(channel, msg, size, UDP_DO_NOT_WAIT, &srcPort, srcAddr));

msg[size-1]=0x00; 

if(g_mereniSGPS) DekodujZpravuGPS(msg);//Dekoduje přijatou zprávu GPS a vyplní proměnné souřadnic a času
}

0 Kudos
Message 3 of 4
(2,221 Views)

Hello, I searched the registry for the size of the buffer according to this location: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Afd \ Parameters \ DefaultReceiveWindow (REG_DWORD) = 16384 (decimal)

Unfortunately it's for windows 7 and for windows 10 I can't find it.

you don't know right innocent location? or can it be set somehow via the command line?

 

Thank you Nice day

Message 4 of 4
(2,197 Views)