iwant2learn
iwant2learn

Reputation: 163

Fetch streams from UDP multicast address

I'm writing a program that receives the UDP streams that are sent to a multicast group address. Assume that I have an address like udp://249.0.0.1. To this address, I receive two streams to two different ports, say 2500 and 2600. I need to write a C program that fetches both streams from the different port within a single program. Can you suggest a starting point (tutorials, useful APIs, …)?

Upvotes: 1

Views: 893

Answers (1)

Karoly Horvath
Karoly Horvath

Reputation: 96306

Create 2 UDP sockets, register both for multicast address.

You can fetch data either with:

  • 2 processes (fork), blocking sockets.
  • 2 threads (pthread), blocking sockets.
  • 1 thread, non-blocking sockets. For the demultiplexing you need select, poll or epoll.

Upvotes: 1

Related Questions