Ping only working one way - android

I've been using a server - client structure programmed in java back in the office for a while now and it worked perfectly. I'm currently trying to use it from home and it doesn't. Furthermore, I've noticed I can ping my phone from the computer, not so much the other way around. But the phone is able to ping the gateway. Anyone has any idea what might be happening?

After #Ernest Friedman-Hill brought to my attention the issues might have to do with the firewall, silly me, I created a new incoming rule in the advanced settings section of the Windows firewall for the TCP port I'm using in the application. It all works like a charm now.

Related

I can not access my notebook with my Android using IPv4

I'm having a bad problem and it already gave me a headache. I did an application with Magic Software and to run it on my Android I have to configure Magic Studio the right way (done), run the project on the Magic server (done and working) and install MagicDev.apk on android (available in the Magic XPA folder and already done), and when finished installing, the application must be run and when it is executed it asks to enter the URL of the Magic application, which is the following: http://[IPv4_of_notebook]/MagicScripts/DevProps.txt, but when you try to access this, it is not possible, it says that the application was not found or the connection failed.
It is worth mentioning, I had this same access problem when using XAMPP or Wamp, because when trying to access the localhost with the cell phone, the link would not respond, it would load until I gave the message (I put Wamp online for this, of course, and changed the settings in the [files].conf). Another important thing is that I made an Android application in Android Studio where one of its functions was to access the internet and although the application installed on Android really could not connect to the link, the emulator accessed quietly (the emulator runs inside the pc, would there be anything?) and I could do what I had to do, this link was on a page I made using Wamp, that is, the emulator accessed my IP, and the cell phone can not.
My question: Is this some configuration of the notebook, Android, Internet router or am I doing something wrong? My friend created a page using Wamp, configured it correctly and placed it online and from my home, with his IP, I accessed the page (with my notebook) in a quiet way. One more note, my notebook connects to the internet with Wifi and my Android too, meaning they are not connected to the source directly as my room PC is, and I do not know if that also matters.
I will later try to run the application on my PC from the room and see if it gives him access to his IPv4, but I do not think it will work either. Anyway, does anyone have any idea what it can be? I do not like messing with my notebook's Internet and other settings without knowing what I'm actually doing, I'm afraid to make my notebook vulnerable. Here in this video https://www.youtube.com/watch?v=1njzFq07t2U you can see the process I'm describing here, but it's not working for me.
I already figured out the villain, it was the firewall. When I turned it off everything worked as expected. I can not keep it turned off for security reasons, but from what I've seen I can configure it to accept only my phone.

Visual Studio 2015 CTP5 Android Emulator loopback to localhost?

I am using VS 2013 to connect with the new VS2015 Android Emulator. This seems to work now and I can debug, set breakpoints etc which is all fine. (Now, I would use VS2015 but it won't deploy properly -never mind).
I am also developing the server app on my machine and using Fiddler as an http debug aid.. not an uncommon situation I am sure.
The server is running (also under debug in another instance of VS 2013) using IIS Express and I have added bindings to the applicationhost.config so the IISExpress server is visible on my LAN from other PC's and I've checked it is visible.
Try as I might I can not seem to get the Emulator to send the http requests back to my computer.
My javascript uses a servicebase to hold the url:
var serviceBase = 'http://192.168.2.4:64963/'; //'http://169.254.220.177:64963/'; //'http://10.0.2.2:64963/'; //'http://localhost:64963/';
The commented ones show the ones I have tried. None of these works.. the first is the IP of my machine on the LAN, the rest are various ones I have picked up here or the Android dev site.. I have also tried:
http://mymachinename:64963
Because I am bringing both web AND API services from this URL I have also tried a chrome browser on my real android phone (over wifi on my LAN) and this can't get to my dev machine either (where my other pc's can). So I get that it probably can't resolve the names? But really not sure where to go next? I wondered about the Hosts file on my PC but not sure if I can/should set an IP address as a host name? .. any pointers? Thanks, Brett
169.254.80.80 is the localhost loopback.
By going to Additional Tools in the VS emulator for Android (click the >> button on the right hand side) and selecting the Network tab, you will get all the information about the network connectivity.
For the localhost loopback, use the address listed under the Desktop Adapter #2. Desktop Adapter #1 should work as well, which is the IP address of your machine.
I am answering this because I have seen a lot of comments/questions about this topic and need to include some bits that it is hard to fit in the comments.. and I have solved it.
First the solution.. was to delete/replace the vsemu.vhd and vsemu.sdcard.vhd for the emulator with safe copies. This was because in my efforts to fix the problem I assume I had changed some setting in the emulator phone data. Sadly I am not sure what.
However, and this checklist may be useful to someone, before this I was led to it by the fact that because I had web services as well as API from my server URL I was able to test webpage access. This worked on pcs but failed on wifi connected android devices on my network with pc names.. as mentioned in my original question. But it wouldn't work with a numeric IP address either.
I had already added the numeric IP to the applicationhosts.config file of IISExpress, but what I hadn't done, because I thought its on the machine its referring to, was execute the
netsh http add urlacl url=http://192.168.2.1:94693/ user=everyone
command to let it all through.
Once I had done this, I was able to connect using the IP address from a phone, and this led me to discover that the Emulator had obviously got some form of problem. Replacing the VHD's fixed this and I am now communicating.
In case anyone else has this issue using the following IP's worked for me:
IP of the machine
169.254.80.80
However, do remember that VS Android emulator is running in a Hyper-v VM,
So I had to punch a hole in my firewall to allow for my application port to be reached by the emulator.
If your using Web API with visual studio 2015 and VS Android emulator this link helped me out a lot
Use 10.0.2.2, This is the loopback from emulator to your host machine.
See link:
http://developer.android.com/tools/devices/emulator.html
I was having the same issue, but none of the above answers were useful for me.
My BackEnd is a PHP SlimFramework Rest Api.
I decided to change the IP in the auto start of the Slim (was localhost:7888), I tried this: php -S 192.168.43.20:7888, and everything was working fine after I configure the calls to that ip.
I hope this may help someone...
In generic the IP you must consider is the IP of the network you are using/allocated to run the android emulator.
Very raw/rude method of finding it is by going to settings (gear symbol on right panel of emulator, not the one inside) and look for ip address. . Or by opening the ADB Logging window and it's on the top left corner.
Now in command prompt type ipconfig and match the first 3 numbers of IP and that's the network your localhost loopback.
Because in many cases we will have more than one ethernets or virtualbox host only networks are running.
Happy Coding!!

Debugger not attaching to UnityPlayer on Android Device

I have a game built on Unity running in an android device. In theory it should be possible to step through the unity code by attaching to AndroidPlayer at runtime.
Well I followed the rules on how to do this.
1) Created development build with script debugging enabled.
2) run the app with script debugging on wifi that has the player.
Initially it worked. Then perhaps a change or two in my network, and I no longer see AndroidPlayer as an option in MonoIDE to attach to. Its vanished and for several days now I am not able to debug. Not only that but i really don't know where to check this. I yanked out the ethernet cable so device and Mac are both on same wifi running on single subnet. Nothing seems to help. But what really dissappoints me is there is really nothing to check in Unity when this type of thing happens. It just try to attach to proess. Hope AndroidPlayer process is there and if its not. Tough luck.
PS: I should add I am on Unity Pro 4.2.04f. It worked fine, then who knows what and it stopped finding the AndroidPlayer. What a mess!
PS: Things I have tried. Pinging to ip address, and telneting to port (successfully to ip:5555)
Note: This is not the Android Debugger I am talking about but a player that needs to be running in the app, and visible to MonoIDE in order to debug.
What I am really trying to understand is what are my options when I cannot see AndroidPlayer as an process to attach to?How does one debug this problem? Are there things in the logg if AndroidPlayer is sucessfully running? How could monodebug not see it? How do I know it it is or is not running on the devices.
Thanks
Have you looked at the IP address of the Android device and attempted to ping it? I find that, here in the UK, our BT provided "home hub" will often, randomly, stop routing traffic between devices on the same network.
I find that if I can't debug (and I believe Unity 4.2 still used wifi debugging) then I usually can't print either and it's because the router has stopped routing traffic.
A quick reboot of the router usually fixes it.
PS Just read about the ping being successful. Have you downloaded and run "wireshark" to see what network traffic is happening? At least that will show you what is happening on the network layer.
Other thought, any sort of firewall running on the debugging machine?
Try to:
1) Disable antivirus
2) Disable firewall
3) Deinstall Xamarin (in case when you use VS for debugging)
That did help me when I had the same problem

Android USB Not Recognized Sometimes

Programming on my Android device in Intellij was working fine for a while, then all of a sudden my Android device started not being recognized-- "USB Not Recognized". I have tried re-installing my drivers, restarting my phone, restarting my computer, and setting up a new project but nothing seems to work. My phone is still recognized about half the time, but I randomly get the USB Not Recognized error.
Same. I get this error very often.
This is how I usually fix it:
Use another cable.
Turn Android debugging off and on again.
Reboot the phone.
Use another USB-port.
Use another USB-port with another cable.
Dunno why. Any pro's who can answer this? :)
I just solved my issue with a really weird fix. It turns out that with a lot of wear, the tongue (which is the little prong that is in the middle of where the USB cord goes on the phone) that the connector goes around can get bent. I figured this out because pushing the front end of my connector down on the tongue made the connection work and pushing the connector up made the connection stop. I read somewhere that if you take a knife or a toothpick and push the tongue up gently, the tongue will bend slightly and return to a position where it can form a proper connection, and oddly enough I tried it and it worked. Weird. Hopefully this helps someone. Just don't push too hard up on the tongue and only do this if you're sure you don't have a driver issue.
This works on ubuntu: sudo adb start-server
Settings -> Storage. Click settings dots ‘USB Computer connection’.
Check the ‘Media Device’ (MTP) check box. If already checked, try checking/unchecking it.
This worked for me
I just tried with the USB and it is working now perfectly.
Use your usb pin to push it up by connecting it to the mobile.
connect the cable with your mobile then slightly move it towards UP.
But be carefull while doing that as it may bent it completely.

How to set up an ad hoc network by using the shell on a rooted Android device?

In the moment I am working with some ad hoc routing protocols (namely OLSR and B.A.T.M.A.N.) on rooted Android devices running Cyanogenmod. My tests are working pretty well. However, there is one thing which really is annoying: I can only connect to an existing ad hoc network, but not create one manually using only the phones. Right now I am using my laptop to set up an ad hoc network and to run a small DHCP server.
Do you know how to create an ad hoc network manually by using the shell on Android? I have found some methods how this should work, but none did work for me. I tried using ifconfig, iwconfig, netcfg and even wpa_cli (which seemed to be the best choice for this). But after any try the system fell back into "no wifi connected" state - even if the phone stayed in ad hoc mode for a couple of seconds while searching for an IP.
I will be so gladful if I can finally get around this problem because then I might actually use my laptop for Internet access (and therefore searching for online help during the tests) instead of using it to set up an ad hoc network. :-)
I'm not really clear on the technical details, but android-wifi-tether requires you to have a custom kernel with NETFILTER support, which I don't know if Cyanogenmod has. You might try using another open source project as an example: Barnacle Tether. It doesn't require a custom kernel.
I've started looking at the source for Barnacle for my own project. It's pretty easy to compile, but I've only just begun playing with it so I don't know the exact answer to your question.
Correct me if I'm wrong, but didn't the old cyanogen tethering app (android 1.6, before tethering was officially offered) create an ad-hoc network for the tether clients? (I ended up using it not to tether, but just to set up a network so I could ssh into the phone from a laptop while I was playing around with USB host drivers and so couldn't use ADB.)

Categories

Resources