julien
julien

Reputation: 11

How to catch all incoming UDP packet with only IP/port source

I'm trying to catch every UDP packet coming from a device ( a camera), which is located on my local network.

The problem is the following: - I know source IP/port and my computer IP, but when I receive the stream, the destination port is unknown.

I want something to bind UDP coming socket to every port, but this method does not exist.

My question is: Do you know how to catch every UDP packet coming from a source, with only source Port and source IP ( and my computer IP, of course).

Thank you

Upvotes: 1

Views: 1774

Answers (1)

Sergio Monteleone
Sergio Monteleone

Reputation: 2886

Your camera should have a destination IP address and UDP port in its configuration.

That is, the camera will send UDP datagrams to that specific IP address and port. It may also support broadcast / multicast (sending to all the nodes in your subnet), in which case one or more bits of the destination address are set to 1 (e.g. 192.168.1.255 which is the broadcast address for the network 192.168.1.x).

You should ensure these conditions are met:

  1. The listening socket is bound to the correct network interface
  2. The UDP port is the same as the one you set in your camera settings
  3. The destination IP address set in your camera is the same as your PC

Upvotes: 1

Related Questions