client server application over wifi using an access point - android

I am building a simple client server application on which both client and server will connect to an access point, lets assume d-link router, and after successful connection client should be able to send a message and server should be able to show it on the screen. So, can anybody give me some ideas about how should I implement this idea?

You can implement this using XMPP. Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML.
For your implementation, you can setup an XMPP server like openfire. You can find a tutorial to setup openfire here. To write your clients you can use the smack API (for java clients) and asmack API (for android). A sample asmack based XMPP android client can be found here. Install this application in your android phones and you can communicate between the phones(send instant messages) using the same. You can also download spark client to test your application.

I have two apps, Server and Client
I installed server app on Mobile1 and client on Mobile2.
Mobile1 has mobile hotspot on. Mobile 2 is connected to MObile1 hotspot.
Mobile1 ip address is 100.109.213.12 and Mobile2 ip address is 192.168.43.33
I used this code: https://www.tutorialspoint.com/how-to-send-data-through-wifi-in-android-programmatically
Connection happens but data transfer is not working.
I couldn't change ip address of phone with mobile hotspot on but for Mobile2, I was able to change wifi to static ip but after that even client is not getting connected to server, which was working earlier.
Can I do data transfer by switching mobile hotspot on one phone and connecting another phone as client to the hotspot and then running client and server apps on these two phones. I am not going to use any 3rd device such as a router.

Related

Connect an Android app to localhost without internet connection

i have an Android app that needs to access offline a MySQL database that's hosted on my localhost (i'm using WampServer).
i can't use USB tethering or port forwarding because my laptop won't have internet connection too.
what can i do?
You can setup wifi, connect your system which contains server and your android device to same wifi. Assign a static IP to your server system and let your android connect to that server's MySql through the IP you assigned. Basically it is nothing much different then your web api and db hosted on cloud server and your android application connect to that cloud using either the domain or ip.

how to communicate mobile app with the soap web service server with out ip address and port

I am developing mobile apps by using Delphi XE8. And also I made soap webservice server by using Delphi XE8. I am developing internal mobile app for an organization. I install webservice server at the organization internal server. And the mobile app communicates with that webservice server. The webservice server publish the soap service. for example http://192.168.1.125:16645.
The mobile app has to be configured this URL to communicate with the server since this changes for every organization.
I don't want to give such a configuration to mobile app users. Could you help me out how can I automate this with this kind of URL?
Any domain things?
There are server implementations such as ActiveMQ which broadcast their own server name via UDP, so that clients can locate them automatically.
See for a related question: Discover a running ActiveMQ message broker using IP multicast and a related blog post by me (with source code) here and here. Indy can be used with the Delphi mobile compilers, so this code should work with your apps.
You can implement the same logic with your server, as long as there are no network restrictions for UDP.

How does android connect to vpn?

Im trying to understand how does google connects to a certain vpn, receive packets and sent packets.
I have tried modifying google's Toyvpn and was able to create and vpn interface and i can see that there are packets sent but i dont see received packets..
I observe that google's ToyVpn doesn't have username and only had server address , port and shared secret (i think is the password).
So now im trying to understand how does google require username and password to connect to the vpn i have created via android settings.Please give some links or idea how do they do it.

Android XMPP client does not connect to Openfire server

I have configured openfire server on my laptop running windows7. Pandion and Spark desktop clients are working fine on the localhost. Tested it thoroughly with multiple users.
Laptop is connected to a wifi network.
I am trying to connect to the localhost openfire from Xabber client installed on Samsung galaxy pop running Android OS. Mobile is connected to the same wifi network.
http://localhost:9090/login.jsp?url=%2Findex.jsp
I am able to access this admin url in mobile browser.
But none of the xmpp clients are able to connect to localhost openfire.
Configuration done-
server- localhost
port- 5222
username and password are exactly same as provided in Spark desktop client.
It would be great to know if someone has the solution.
Thanks.
You cannot use localhost in the android client to connect to your laptop. And i do not believe that using localhost in an android browser would connect to a server on your laptop. You have to use the local ip address of the server to connect. Often something like 192.168.#.#.

Communication between app and server over cellular network

I'm developing an Android application that communicates with a Rails server. When the application is run on the same network as the Rails server, everything works well (I can access my database on the server). However, when I use the 4g internet on my phone, I can't connect with the server.
My question is, how can I modify my Android app/Rails server so that my Android app can contact my rails server without having to be on the same network?
Thanks in advance!
Make sure you're not starting the server in development mode. Generally, in development mode the server accepts by default only requests from the same machine (no network connections are accepted).

Categories

Resources