This question already has an answer here:
As the title says, I need to know which app establishes a connection to a host on a specific port (in my case within LAN).
In case the answer depends on the platform: The device is a Moto G (xt1045) with the stock Android 5.1 which is not rooted (and not rootable).
I think the question is meaningful as is, so it should not be necessary to read the following to answer it. As it will probably be asked anyway and should help establish context, here is my broader problem:
I have a homeserver that also acts as home entertainment system using Kodi. Kodi starts when any packet is received on port 8080, which is the case when remote apps like Kore or Yatse are used on android. With my old phone (older android version) it worked fine. With my new phone Kodi starts whenever my phone is in the LAN. Logging on the homeserver confirms the received signals originate on my phone. However I have removed the remote app from the "app switcher view" and it is not listed under running apps. So I want to know which app actually establishes this connection (the remote app shouldn't be running and other apps shouldn't connect to that specific port, so I can't figure it out in any other way).