UDP upkt.Validate()
Posted: Mon Dec 15, 2008 9:31 am
There are 2 examples of receiving UDP data in the programmers manual.
One method is:
RegisterUDPFifo(port, &FIFO);
And the other is:
int UdpFd = CreateRxUdpSocket( port );
I am confused as to why I would use one over the other.
More importantly is the upkt.Validate() call.
if I use the later UDP listener, does it automatically take care of validation ?
For example, if I use:
int len = recvfrom( UdpFd, (BYTE *)buffer, 80, &SrcIpAddr, &LocalPort,
&SrcPort );
when it returns len > 0 has it already confirmed that the UDP packet checksum is valid ?
or if I want to make sure the checksum is valid, I would have to use the first example and call upkt.Validate() myself as in the example.
One method is:
RegisterUDPFifo(port, &FIFO);
And the other is:
int UdpFd = CreateRxUdpSocket( port );
I am confused as to why I would use one over the other.
More importantly is the upkt.Validate() call.
if I use the later UDP listener, does it automatically take care of validation ?
For example, if I use:
int len = recvfrom( UdpFd, (BYTE *)buffer, 80, &SrcIpAddr, &LocalPort,
&SrcPort );
when it returns len > 0 has it already confirmed that the UDP packet checksum is valid ?
or if I want to make sure the checksum is valid, I would have to use the first example and call upkt.Validate() myself as in the example.