How to connect to a local server using windows hosted network - android

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.

Related

WAMP server: change wireless SSID and server not reachable

This is a really strange thing.
I got a working WAMP server on my laptop, installed Laravel and a web application available to my clients on the local wireless network. Everything is working flawlessy. I can communicate between my android app via the wireless AP TP-Link to the WAMP server. No need of internet, this is a LAN just for devices behind.
Now, I decide to change the SSID of the AP. Change from "Zapp" to "Polls".
Restart everything: AP, laptop, mobile phone. The server is not more reachable by my mobile phone.
I can ping the IP address using a terminal app, but I can't access to it anymore. This, just changing the SSID. If I revert to "Zapp" SSID, everything work again.
I checked IP's: the change of SSID not change IP's of clients.
Could anyone explain and help?
Technical devices:
AP: TP-LINK TL-WR841R
Server WAMP v. 3.0.6 on a Toshiba Laptop
Android Phone OS 7.1 OnePlus3
Check Windows firewall profile. It might classify the network with the other SSID as Public and ports are not opened?

How can I connect an android client to my XMPP (ejabberd) server, hosted on my local machine (Windows based OS)?

I want to test my ejabberd (xmpp) server, which I've hosted on my laptop, which is working on windows 10 based OS. I want to connect my android client to this server. So I went on to the internet, and found some solutions. But they seem don't work for me. This is what I've tried:
1.) Create a hotspot on a phone. Don't use data/wifi connection, as server is already on the machine.
2.) Connect the laptop to the hotspot.
3.) On cmd (running as admin), type 'ipconfig', after starting xmpp server (Obviously).
4.) Copy IPv4 address (External IP), and access web panel on the mobile browser through it.
So, I hurried toward my phone, and typed
http://[IPv4 Address]:[port open on the server for incoming connection/5280]/admin
But it(browser) throws 'Can't reach the webpage' error.
When I run
http://localhost:5280/admin
on my laptop, I could easily access my web portal, but It's unreachable on my android phone. What can I do now?
Well I solved this problem by accessing IPv4 of my laptop through my wifi router, and connecting to the port of my server through it. Initially, my browser (both of my laptop and my phone) weren't able to reach the server's port. But I later figured out it was problem in my .yml configuration file. Server wasn't set to listen all the IPv4 calls, instead it was listening to all IPv6. So I changed this, and it then become accessible to all devices on the same wifi. So it was my bad idea to connect it through the hotspot :P

Can't access to local server with Android

My problem is linked with this post : https://stackoverflow.com/questions/28982225/android-local-server-access-over-wifi/
I have a website hosted with MAMP on a Mac mini, connected to a D-Link router. I've got a Wifi-antenna (ubiquiti) which is connected to this router too, it creates a Wifi (offline) LAN.
When I try to connect to the Mac mini's IP, it displays the website from other devices (iPhone, Windows PC) but with Android it doesn't work.
I'd like to know how the developper in the link I refered did "use DNS by redirecting all domains to his custom domain".
Or if there is another way to work around this... Client devices which connects to the Wifi network shoudn't (I wish) have to configure manually their Android network parameters...
EDIT:
ngrok.io is not a solution :
clients may not have an 3G/LTE connection on their phones
the adress / IP should be the same every time the Mac reboot
Thanks in advance

Making android as a server?

I am using an android device as a web server. Everything works good in localhost, but i want it to be published. My device connects to internet through wifi, not 3G.
(device)--->(wifi router)--->(modem). I tried to foward the port but it didn't work. Seem like my device's ip was provided by the router, not the modem, therefore the modem cannot "see" it. Can you help me to do this? I want my server to be published.

Testing app beetween real device and emulator via WiFi without router

I develop app which contains a client and a server side, so I need to test work between them. I have a real android device and I want android device to connects to emulator. I'm working at work sometimes(if I have free time of course) and at home. I have the WiFi router at home and I can connect to the real device by emulator(TCP listener running on the real device), but not vise versa(I don't know which exactly IP to use). But at work I have only hot-spot WiFi point without router. My android device connects to it fine. Even more ADB can connect to the device when adbWireless running on it. But it doesn't work, I can't connect to tcp listener in any cases. The difference between home and work is existence of WiFi router. Are there any solutions? If not why Android debug bridge(ADB) can connect to adbWireless? Thanks.
I solved the problem. I run tethering on my real device and run the server on it. Then I use a program Connection state viewer there is a link: https://play.google.com/store/apps/details?id=ru.nolesh.android.connectionstateviewer It helps me to find IP address. After that I start the emulator and the client side on it. So I connect to my server by given IP.

Categories

Resources