Just to understand your question a bit more - you want the device to be connected to a Pi4, which itself is getting it’s internet from a PC. Is that right?
I use a software on a pc that sends data in udp to the device.
but I would like to go through the rpi
concretely an ssh server on the rpi4 would do the trick.