Re: UDP using CAsyncSocket



DecafCoffeeDrinker wrote:
I have always used CAsyncSocket to make TCP connections. But for my current
project I need to receive from a UDP stream. I thought I would just use
CAsyncSocket and specify SOCK_DGRAM in the Create function. I asked my
client for the address and port I should be using. He told me the port
number and said "its UDP, I don't need an address". I said "Oh" and I left.
I never connected to UDP before so I don't know. Now I am in my office and I
am looking stuff up and I am confused...

For UDP, do I need an address to receive data as a client?




UDP packets can be sent to an address or they can be broadcast.

To receive UDP with CAsyncSocket just call Create(Port, SOCK_DGRAM)
and when OnReceive is called call ReceiveFrom.  No address needed.

--
Scott McPhillips [VC++ MVP]

.