May 11, 2024, 02:03:08 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


UDP buffer ?

Started by paja, October 07, 2009, 05:16:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

paja

Hi

How can I flush UDP buffer ?

sapero

If you mean UDP socket buffer, then you need to read all existing data:

sub EmptySocketBuffer(SOCKET socket)
int TotalBytesToRead

if (!ioctlsocket(socket, FIONREAD, &TotalBytesToRead) and TotalBytesToRead)
pointer buff = new(char, TotalBytesToRead)
recvfrom(socket, buff, TotalBytesToRead, 0, 0 ,0)
delete buff
endif
endsub