IonicWind Software

IWBasic => GUI Central => Topic started by: paja on October 07, 2009, 05:16:49 PM

Title: UDP buffer ?
Post by: paja on October 07, 2009, 05:16:49 PM
Hi

How can I flush UDP buffer ?
Title: Re: UDP buffer ?
Post by: sapero on October 07, 2009, 09:40:29 PM
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