Maybe I'm typing the wrong words by google but I' totally lost and can't a solution.
On my work we all access our projects through server alias like project.company.local
But when I'm at home with my company notebook I can't reach my websites aliases from e.g. my smartphone or any other device at home. Although they are all in the same network.
I have Ubuntu and Apache on my notebook.
My etc/hosts has
127.0.0.1 projectA.company.local
What am I missing?
Your hosts file only works for the computer itself, not other machines on the network. Your work must have the appropriate entries set up on the DNS server. You could just access a site on your home computer, from other devices on the network, using the IP address of your computer, instead of a host name, if it's just one site. Otherwise perhaps your router will allow adding DNS entries for the local network. If you're going to do that, you'd also best set up a static IP address for your home computer so it doesn't change. Hope that is enough info for you to get it sorted.
volley is not working when i want to fetch data from a system on my local network.
where URL is like http://192.168.x.x/data.php
it works well on emulator but not on a real device. it show a time our error.
even i tried setting a maximum time our and retry policy. but in vain.
There are two ways to solve this:
a) keep your device connected to the PC which is connected to your local network either using lan or wifi. Keep debugging mode on. Use ipconfig to check your pcs ipv4 address and use that.
forward your server's port on your router and then use the ipv4 address found on your pc's ipconfig command.
c) Best option-> i use this. Forward your pc's server port on your router, Go to your router's DHCP configurations and give your pc mac a preferred DHCP ip to make sure your router always gives that local ip to your pc(global will still be dynamic if you dont have a static ip). Register to a DDNS and use the set ip above and you will be able to access your web service from anywhere in the world. (i use dynudns for the ddns part)
see How can I access my localhost from my Android device? for other ideas
In the first two steps, make sure that the mobile is connected via wifi so that the router can forward it requests. in third, it can be connected to the internet anyway it likes. Also in the first, you will have to change the url everytime your local ip changes.
In second option, the dns will give a tool for auto ip updation :)
I am trying to debug my visual studio 2012 asp.net project from my phone and have followed all steps here and here.
However none of them work, can't even connect from my other laptop. When I add my public IP or use * IISExpress doesnt even seem to pick up on it (Can't find it in IISExpress->show all applications). But When I used my local IP at least it showed up there and I could connect to it from my own computer, but no other computer/phone.
The cmd commands are successful, I add the extra binding, I open the firewall. Dont know what is wrong.
Which IP (local/public) should I use? what should I type in as URL when I want to test it? I am trying http://IP:port and http://IP:port/Default.aspx.
EDIT: Using this solution I got it to work on my laptop, however I still can not get it to work on my phone.
Basically, the points mentioned in the links you have cited are enough for enabling communication with the phone. But here is one point to make sure (since you have not mentioned it): You have to make sure that both the server and the clients (in your case, the machine that runs the visual studio and your phone and the other laptop) are on the same wireless network. To find out the IP that your server/development machine is currently using, you can issue ipconfig command in cmd and look at the Wireless Network Adapter IPV4 address. For example, if your laptop IP address is 192.168.1.2, you should use http://192.168.1.2:8080/Default.aspx (assuming that your site runs on the port 8080).
You use the local IP if you're on the same network as your server (for example, use WiFi on your phone and join the same network that your server is on).
You use the public IP if the device is outside your network, and you have to configure the firewall to forward the correct ports to the local IP. That's NAT traversal. This would be if you're using the phone's cellular data connection, or you're using a WiFi or wired network that's different from the one your server is on.
Your URL should always be of the format <protocol>://<IP or DNS name>:<port>/<path>. However, you can omit the IP (and the colon) if you're using HTTP on port 80, or HTTPS on port 443. And you can omit the path if you're accessing the root of the site, and your site has a page correctly configured for the root (either via default document in IIS, or route defaults if you're using routing features).
I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home.
i read a lot questions and answers regarding this issue in stackoverflow and other places, but none of them gave me some concrete solutions.
I have samsung tab 2 10.1 with android 4.0.4.
appreciate any help, thanks
So, there are a couple of issues it seems. The question most of the answers are addressing is "how do you connect to another server in your local network?" (or variants). There are two answers, you can use the computer's IP directly, or you can use the computer's name (you may need to append .local). For example, my computer is xavier.local.
The second issue is that you seem to be addressing is that runserver is not accessible via other computers on the network (this is your actual question). The reason is that by default Django's runserver will only acknowledge requests from the machine which is calling them. This means that the default settings would make it so that you would only be able to access the server from Windows (and they did this on purpose for security reasons). In order for it to listen to other requests you have two options:
runserver 192.168.1.101:8000
# Only handle requests which are made to the IP address 192.168.1.101
Or (and this is easier when dealing with more than one environment):
runserver 0.0.0.0:8000 # handle all requests
So, if your IP address is 192.168.1.101:
runserver # only requests made on the machine will be handled
runserver 127.0.0.1 # only requests made on the machine will be handled
runserver 192.168.1.101 # handles all requests (unless IP changes)
runserver 192.168.1.100 # does not handle any requests (wrong IP)
runserver 0.0.0.0 # handles all requests (even if the IP changes)
I do think it important to note that 0.0.0.0 is realistically not a security question when dealing with a local, development machine. It only becomes a significant problem when working on a large app with a machine which can be addressed from the outside world. Unless you have port forwarding (I do), or something wonky like that, you should not be too concerned.
Though this thread was active quite a long time ago. This is what worked for me on windows 10. Posting it in details. Might be helpful for the newbies like me.
Add ALLOWED_HOSTS = ['*'] in django settings.py file
run django server with python manage.py 0.0.0.0:YOUR_PORT. I used 9595 as my port.
Make firewall to allow access on that port:
Navigate to control panel -> system and Security -> Windows Defender Firewall
Open Advanced Settings, select Inbound Rules then right click on it and then select New Rule
Select Port, hit next, input the port you used (in my case 9595), hit next, select allow the connections
hit next again then give it a name and hit next for the last time.
Now find the ip address of your PC.
Open Command Promt as adminstrator and run ipconfig command.
You may find more than one ip addresses. As I'm connected through wifi I took the one under Wireless LAN adapter WiFi. In my case it was 192.168.0.100
Note that this ip may change when you reconnect to the network. So you need to check it again then.
Now from another device (pc, mobile, tablet etc.) connected to the same network go to ip_address:YOUR_PORT (in my case 192.168.0.100:9595)
Hopefully you'll be good to go !
You can find out what the ip address of your PC is with the ipconfig command in a Windows command prompt. Since you mentioned them being connected over WiFi look for the IP address of the wireless adapter.
Since the tablet is also in this same WiFi network, you can just type that address into your tablet's browser, with the :8000 appended to it and it should pull up the page.
127.0.0.1 is a loopback address that means, roughly, "this device"; your PC and your android tablet are separate devices, so each of them has its own 127.0.0.1. In other words, if you try to go to 127.0.0.1 on your Android tab, it's trying to connect to a webserver on the Android device, which is not what you want.
However, you should be able to connect over the wifi. On your windows box, open a command prompt and execute ipconfig. Somewhere in the output should be your windows box's address, probably 192.168.1.100 or something similar. You tablet should be able to see the Django server at that address.
need to know the ip address of your machine ..
Make sure both of your machines (tablet and computer) connected to same network
192.168.0.22 - say your machine address
do this :
192.168.0.22:8000 -- from your tablet
this is it !!!
If both are connected to the same network, all you need to do is provide the IP address of your server (in your network) in your Android app.
Tested using easy EasyPHP DevServer 14.1.
The trick is you must first add your local ip address to the Apache server to listen to it.
Right click on the tray icon, go to "Configuration" -> "Apache" in the "httpd.config"
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 127.0.0.1:80
Listen 192.168.0.201:80 <<-- ADD THIS LINE
Then go to your Control Panel and deactivate your Windows Firewall or add your Smartphone/Tablet Ip Address to the exception.
That's it. I hope it helps.
The IP Address 192.168.0.201 may be different from yours. 192.168.0.X
I've struggled with this problem myself, and I couldn't figure out what it was, since it worked perfectly on my iPhone, I decided to look into the problem and find a quick solution.
My local machine is a Mac OSX 10.10+, one option would have been to start an Apache server, but that's super unhandy - changing the DocumentRoot every time you want to check something quickly on your Android device. Besides that, changing the DocumentRoot is a pain in the a** on Mac OSX 10.10.
If you want to use:
python -m SimpleHTTPServer
on your Android, do this:
sudo python -m SimpleHTTPServer [ANY PORT YOU WANT, BUT NOT 8000]
I hope this helps.
cheerz -Pit
Try this
python manage.py runserver
then connect both tablet and system to same wifi and browse in the address
eg: python manage.py runserver 192.168.0.100:8000
In tablet type that url in adress bar
In my case I was required to disconnect and reconnect to the same network (both phone and pc), after changing the firewall settings.
I am developing a site on my machine. I am using a Virtual Host, so that my site address for the project is mysite.local.
Typically, I can access my site on other machines on the network by typing http://ipaddress/projectfolder (which is in htdocs). But since I am on virtual host, I "can" access it on any computers by pointing the host file to the xampp host machine. But I don't think I can do so on my android tablet, since there is no host file to speak off.
Any advice on this?
Thanks.
One possible solution is to use one of the localhost tunneling tools to temporarily make your site visible to the public Internet - this would allow you to test it from any device that has Internet access, so you can do things like test how it performs over 3G or ask a friend to take a look too.
Two such tools include:
PageKite - https://pagekite.net/ (disclaimer: I wrote this one)
Localtunnel - http://progrium.com/localtunnel/
There are others, but these two are both open source with an optional online service component, so you can choose whether you want to run your own relay in the cloud or use one provided by the authors of the tools.
Even though the question might not be the most recent, I just ran into the same issue and found another possible solution.
If you want to access one site from within your lan, you can add another virtual host that listens to your local IP, as follows:
<VirtualHost 192.168.0.100:80>
ServerName loc.al
DocumentRoot "/path/to/project/"
DirectoryIndex index.php
<Directory "/path/to/project/">
Options -Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
That would forward any incoming requests from your local IP to the DocumentRoot specified inside that virtual host.