Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UDP Receives in C++ Builder

156 views
Skip to first unread message

Jim Morris

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
Agron Selimaj wrote:
>
> UDP is not a good protocol, is has no error checking or verification
> of whether data is received on the other end. It is a base protocol on
> top of which you build your own; with controlls and verifications.
>
> You better use TNMStrm and TNMStrmServ. You can stream anything and it
> works well.

Well, that's all good advice. Unfortunately, I cannot take it. The
application I am developing has to receive UDP packets from an embedded
system - and the UDP data is being generated on the fly by an ASIC or
FPGA. I am told it is too late to change the hardware design - and it
is sending data using UDP, with no possibility of getting data to be
resent.

Thanks anyway...

I've since found that there is an inherent problem with using blocking
sockets with the recvfrom() Winsock call - which is what
TWinShoeUDPListener does, and I'm sure the TNMUDP does as well. It
looks like the only way to get acceptable performance will be to perform
multiple overlapping I/O requests from a thread, using the non-blocking
WSAsyncSelect() call to set it up.

It also turns out that Windows only had an 8KB receive buffer for the
UDP socket. If you don't empty it before it fills up, any additional
packets coming in are discarded by the OS's networking code. This is
according to information I got on the WINSOCK-2 mailing list, from an
actual Microsoft employee...

--
/------------------------------------------------\
| Jim Morris | Business: jmo...@rtc-group.com |
| | Personal: J...@Morris.net |
|------------------------------------------------|
| AOL Instant Messenger: JFM2001 |
\------------------------------------------------/

Steve Horsley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Looks like you got it cracked, then. Good.

If you don't want to play with WSAsyncSelect and message maps yourself,
you could give Francois Piette's ICS components a try. They're free, and
the socket component uses asyncSelect, giving you a DataAvailable event
within which you can call its ReceiveFrom() method.
See http://www.rtfm.be/fpiette/indexuk.htm

I have used it to do TFTP transfers, and the performance looks good to
me, but I have to say that TFTP only ever has one packet in transit at
a time, ping-pong style, and I don't know if it can reach hundreds of
packets/sec. I never measured it, just thought "Blimey, that's fast!".

Steve.

0 new messages