开发者

Fetch streams from UDP multicast address

开发者 https://www.devze.com 2023-03-15 12:29 出处:网络
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 diffe

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, use开发者_运维问答ful APIs, …)?


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消