Search code examples
network-programmingwifilan

How do I create/manage the stuff on private IP address of a device connected to LAN?


Okay. I really didn't know how to explain the question in title. What I actually want to do is this:

Suppose a device is connected to WiFi, i.e. it's on LAN. It would have a private IP address like 192.168.xx.xx like that. What I want is my (android app/or technically general way) program to have access to that IP and display some info on it, like a webpage or maybe live screen of the device itself?

For ex: http://192.168.0.105:5901/thisScreen would stream live screen of a mobile device. This URL can opened by any device connected to LAN. How do I achieve that streaming access on that particular IP address assigned to the device? (Assume I've control to everything).

How do I even begin for this? Networking? How do I implement it? Any references? I tried to Google my problem but didn't find any help.


Solution

  • Since you ask in general, what you want is to serve sth on a lan ip ex: on 192.168.1.50:80 and that is available to everyone on the same lan to be precise in 192.168.1.0/24 right?

    Well if you haven't done any configuration such as subnets smaller than /24 that is what happening by default.

    To confirm that run a web server an nginx for example on a local machine and visit the ip of this machine from another device on the same lan, you will see the default page of nginx.

    So the only thing you have to configure is a service to run on a local machine and serves sth.