-1

I am using UDP BSD sockets in C, and I need a way to receive all packets sent to my IP on a range of different port numbers. My current code can detect packets only on one port that I specify. Is this possible to do, or should I look for another way to accomplish this?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Your current code such as what? – user207421 Dec 31 '20 at 06:00
  • Welcome to StackOverflow! See [minimal-reproducible-example](https://stackoverflow.com/help/minimal-reproducible-example) on how to create a minimal-reproducible-example. – wuerfelfreak Dec 31 '20 at 08:00
  • 1
    Depending on your environment you might use raw sockets or you might firewall rules to redirect traffic destined for many ports to a single port (i.e. iptables redirect, pf divert etc) and thus get the traffic no matter what original port it was sent to. – Steffen Ullrich Dec 31 '20 at 10:28

1 Answers1

0

You would need to start a listener for each port number you want to listen to

Matt Douhan
  • 2,053
  • 1
  • 21
  • 40