Re: UDP using CAsyncSocket
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Tue, 26 Apr 2005 20:20:48 -0500
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]
.
- Follow-Ups:
- Re: UDP using CAsyncSocket
- From: DecafCoffeeDrinker
- Re: UDP using CAsyncSocket
- References:
- UDP using CAsyncSocket
- From: DecafCoffeeDrinker
- UDP using CAsyncSocket
- Prev by Date: Re: How can I display multiline at an item in The CListCtrl?
- Next by Date: Re: show CButton as clicked down
- Previous by thread: UDP using CAsyncSocket
- Next by thread: Re: UDP using CAsyncSocket
- Index(es):