Osc communication between laptop and tablet in same WiFi network - android

I want to let my laptop and tablet communicate via OSC using OscP5 java library.
Tablet is android device and application is made on android studio.
Laptop is Windows 8.0 and application is running on Processing 2.2.1. Both uses same library OscP5.
WiFi network is very huge and strong in public government office. Both devices are obviously in same WiFi network named - Public WiFi Free. Both devices are using wireless(WiFi)
What I'm doing is very simple.
Send some integer from tablet to laptop through UDP unicast.
When I confirm IP address,
Laptop : 192.168.25.219
Tablet : 192.168.26.83
It's strange that they have different address which are 25 and 26.
I tried to reconnect on both device many times, but they always get same IP.
Problem is not port. I certainly confirmed that port is same(13000).
and laptop is just listening 13000 port and not sending anything.
Tablet is just sending to laptop IP on 13000 port.
I searched a bit and people are saying that if 1st, 2nd,and 3rd part of IP address is not same, OSC doesn't work. Is this the problem? and if so, Why? I'm kind of noob about network so please explain easily..

Problem was firewall...
Anyone who came to this post must confirm whether firewall is blocking your port or not. There are 2 possibility that firewall is blocking your port on router level or your OS level.
The first case, you have to access administrator setting page of your router and enable VPN(Virtual Private Network) pass-through or open port.
The last case(mostly in Windows because firewall is option in OS X), you simply go to settings and disable Home network level firewall, or you can add exception for you port.
I hope someone will not have hard time like me because of firewall.

Related

How to connect to a local server using windows hosted network

I am programming an Android app which connects to a TCP server running on my computer using sockets. This works perfectly fine as long as both my computer and my smartphone are connected to the Wi-Fi of my router.
I want it to also work when my computer and my phone are not connected to the Wi-Fi. Therefore I configured a Wi-Fi hotspot using hosted network on my computer. My smartphone recognizes the Wi-Fi and is able to connect to it. But now my app can't connect to the server running on my PC although I changed the code to the new IP that I got by using ipconfig on my PC.
I downloaded an app named "Fing" from the Google play store. The app shows all devices in a network. It does show my computer under the right IP address. I don't understand why my app can't connect to the server running on the PC.
On the one hand, I don't think that the problem is in the app's code, because it works on the router's Wi-Fi network. On the other hand, I doesn't seem to be a setup mistake either, because Fing is detecting my PC.
Do you have any ideas what the problem might be, or any other solution for my needs?
I actually wrote the TCP server myself using c#. I configured the Server to listen to all of my computers networkinterfaces usingIPAdress.IPv6Any. I also did configure it as dual mode socket so it can accept ipv4 and ipv6 connections. I will post the code when i am back home. So the TCP server also looks ok to me.

no dns via ipsec tunnel android 4.4.2 xperiaz C6603 racoon

I've setup a racoon server on my linux router. It was working ok with my xperiaz (C6603) road warrior. However after I applied the latest update to android 4.4.2 (firmware 10.5.A.0.230) it stopped working correctly. I have ping from the phone to each ip (local ip or internet) but when I use FQDN it can't be resolved. I can ping the phone from within my local network too. VPN is IPSec Xauth RSA. Checking with adb DNS server is correctly set:
getprop net.dns1
192.168.6.1
I also tried pushing the same ip as dns2 but no change. I also noticed that after closing the connection to the vpn server net.dns1 remains 192.168.6.1 however the phone is able to correctly resolve addresses. In few minutes it gets changed back to my 3g provider setting.
I tried to redirect all traffic through the tunnel via the advanced vpn setting (Forwarding routes = 0.0.0.0/0) and tried to set DNS statically via the same settings (DNS servers = 192.168.6.1). Even setting the DNS server to my provider's DNS addres didn't work which makes me think the problem is with the android itself.
DNS server is working as far as I can tell:
$ dig #192.168.6.1 dir.bg +short
194.145.63.12
Forwarding is enabled on my router so shouldn't be the problem. I've read about a bug in android but it's in android 2.x and seems to impact wifi connections.
Have you seen similar problems and as I'm not an expert with android and adb, can you tell me what commands are available in adb/shell to trace the problem? Phone is not rooted and it's not possible for the moment to root it.
UPDATE:
the tunnel is working ok when I connect via wifi hotspot. The problem appears to show only via my 3g carrier. Any ideas how to work around this?
After updating to 4.4.4 I still got the same problem. Further testing revealed that the problem is more likely to be in the Android rather than my 3g carrier. Over wifi the VPN worked flawlessly after using wifi tethering from another phone via the same provider it worked ok again so my 3g carrier isn't blocking anything.
Yesterday I finally rooted my phone and installed SDFix to restore full access to my SD card. Now VPN is working ok again even via 3g. I hope someone can confirm/reject that solution as I see no relation between vpn and sd card at all. However I experienced initially the problem with my update to 4.4.2 where Sony started to follow Google's policy about storage access.

How can two machines detect each other when their ips keep changing?

Let me describe what I want to achieve and where I am stuck. It is okay to suggest an entirely different alternative.
I have an Android phone with NFC feature.
I have a macbook pro.
A wifi network.
Whenever I tap my phone on a certain NFC tag I want my Macbook to run a certain script.
So I did the following
An android application that is invoked whenever the device senses a particular NFC tag.
My Macbook runs a NodeJS HTTP server
Android app sends an HTTP request to NodeJS, NodeJS then invokes whatever script I wanted to run.
This setup works perfectly at my home where I can Set the IP address of my Macbook to whatever I want. But i want the same setup to work transparently when I am in starbucks (or workplace) and both my Android and Macbook are on the same Wifi network. (I dont want to enter the IP addresses manually).
When I was halfway through I realized that I could have used bluetooth feature on the Macbook but then I will probably have to write a sophisticated program on macbook to listen to the Android device and accept commands.
On Android, use Network Service Discovery. If you're using an earlier target, jmDNS is your friend. I have only used this to allow android devices to find each other, but this should be compatible with bonjour service on your Mac.
Solution #1
Use a network service discovery technology. I would perhaps suggest Zero Config which Apple implements as "Bonjour"
Solution #2
Have a third device with a known IP address for bookkeeping the other devices' IP (essentially what DNS is)
Solution #3
Setup your WiFi network to have static IPs : allocating predefined IPs to computer with specific MAC addresses (that way clients can still have "DHCP" but the router would always allocate the same local IP)
I'd look into dynamic dns. You can use that to automatically update dns names for a computer that changes IP addresses.

Android "localhost" sockets fail when no data connection?

I'm designing an Android app that will require the use of a web server on the local device. I've been trying out some different servers for this purpose. At present I haven't written any code or run anything in an emulator, just played around with the servers on my actual phone, and I'm observing some strange behaviour.
Whenever I try to connect to the local web server, and I have WIFI switched off, the HTTP request fails. If I switch WIFI on, it succeeds.
Depending on which address I use, I get different results: using localhost or 127.0.0.1, I get connection refused when WIFI is off; using the current 10.X.Y.Z address I get a timeout. Both addresses work when WIFI is on.
I have tried this with xWS, PAW and i-Jetty: the behaviour is consistent. WIFI on, I can connect to the local web server; WIFI off, I can't.
I am using the default "Internet" browser on Android 2.3.3 on a Samsung Galaxy S (GT-I9000).
Does anyone know why this is? Is it a simple question of a setting somewhere I need to change, or what's going on?
Cheers,
/Uffe
Can you change the network interface the web server is connected to?
The default setting is probably something like eth0 or wlan0, if you change it to lo it could work.
You are asking why when you turn off your wifi, there is no connection to the 10.0.0.2 (Your computer's localhost) and when you turn it on, there is a connection?
Very simple. Wifi off - NO INTERNET connection. The device emulator is a separate OS inside your computer's OS. When you turn off your WIFI there is no route to the host (your computer) - there is no internet
I have now tested with my own simple client, and with Opera - and it works.
So in fact this is an issue not with the IP stack but with the default Android browser, or possibly with the settings enforced by the manufacturer (Samsung) or carrier (Telenor Sweden). Either way there is a workaround: use Opera instead.
Still don't know why it doesn't work with the default browser, but I'll mark this question answered.

TCP connection from phone to debugging host

I'm developing client/server software for Android.
While connected to the phone via USB debugging, I'd like to access the webserver I'm running on my developement PC - using the USB connection.
Is that possible and if so, how ?
I stumbled upon the answer after a night sleep.
Enabling USB tethering on my phone (N1, 2.2.1) gives it and the host computer an IP address. The phone can communicate with my web server running on my developement machine!
(Chris, the rumors are right)
Just make sure your web server is listening on that IP address. For apache, use the line
Listen 80
or
Listen x.x.x.x:80
(x.x.x.x being address of your android tunnel)
The easiest way to do it is via wireless. If you don't have wireless, I'd say bite the bullet and get it, it's going to be a necessity for testing anyway :)
Typically the USB only supports connections from the development machine to the phone (via adb port forwards) and not the other way around. Of course once a connection is created data can move bidirectionally. One could use this to build a tunneling proxy web proxy (one connection in from the development machine to a daemon running on the phone, outbound connections from the phone then tunnel through this)
I have heard rumors though that what you want to do - often called reverse tethering - may be supported in some more recent devices.
Kevin's wifi suggestion may be the simplest with a real device.
On the other hand, unlike typical phones, the android emulator can directly access the development machine's loopback interface at an alias address given in the documentation.

Categories

Resources