Summary
I have set up a udp packet listener in python, and I would like to be able to identify the device that is broadcasting the data it receives.
The Goal
I have a PHP web page that is reading the data from a database, which is being populated by the listener inserting the data when it receives it. My goal is to have a toggle switch that allows the user to select which device to hear data from. So currently, data is only being broadcast by either an MT4000 telemetry device, or using the terminal to manually send data across port 30000.
I don't want to identify it from a specific serial port, as described in: Identifying serial/usb device python But rather wherever it is connected (any serial ports).
My Method
My idea at the moment is to somehow, send a message back to the same device from the listener, acting as both an acknowledger, and as a scan, to ask what the device is. Is that a feasible way?
Problems
- Increases the amount of data being transmitted massively with more back and forth packets.
- It may not work for every device connected, methods of extracting identity may be different for each device.
Once the python has identified the device, I will insert into the database, and when the user selects a device, a modified query will be sent, ie
("SELECT * FROM table WHERE device = MT4000");
I feel that this is not a clean method to use, and would be very open for different suggestions.
The solution
Unless it helps get across an answer, I'm not looking for specific code, but rather the theory of the task.