How does android connect to vpn? - android

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.

Related

Find out ip of server android app is using

So, i am testing my app, it saves data of accounts to a server, and i am wondering if it is possible to get server ip by just having app instaled.
Is there some methods?
Of course. You can get the IP just by checking the router and seeing where requests were made to, you don't even need to run the app- just someone on the network needs to. IP addresses aren't secret.

Which is best solution for p2p connections

I'm thinking develop android application,Where is s/he?.
If client 'A' request location of client 'B',Server connect client 'B' and get gps location of client 'B' and server response to client 'A'
Application should work in background but should not force hard to mobile device.
There should be no trafic between client and server if there is no request. Traffic should be if there is request.
Like Skype or whatsup,you can connect client everytime you call or sending message If client is on internet so that my application should work if both users on internet. İf requested client is not on internet then application should send latest known position.
For these porpose,Which protocal should I use? Http(I think no),TCP ,XMPP or android bound service implement my methodlgy?
How do I implement my applcations methods?
thanks
I do not want to offend you, but I think you should start with the fundamentals of android development and distributed systems.
However, here is my answer:
You could use HTTP, but better use HTTPS to be sure, that data is encrypted between the server and the client.
If I were going to create such an app, I'd write a small application on the android device which transmits the position of the device, together with a unique id of the device (probably the IMEI) to a server, encoded in a HTTP(S) request.
Using HTTP would have the benefit, that you could use many different languages on server side, for example PHP (would be my choice, but you could use others).
On the server side you would need to put the recieved data into a database or some other storage.
From there it is your choice what you are going to do and how to present the data. Maybe making a small website?
Regards
Me

client server application over wifi using an access point

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.

how to send data from mobile to mobile except SMS

I'm using C2DM in my Application to send data from mobile to mobile
But C2DM uses Google server(lacks data confidentiality) to redirect messages to device.
Is there any other way for sending data from mobile to mobile directly without any third party server?
I dont want to use SMS in my App.
Base on requirement (1) Without third party server (2) Between 2 mobiles.
Your options are limited to these:
WiFi Direct (Ad Hoc Network)
http://developer.android.com/guide/topics/wireless/wifip2p.html
Bluetooth
http://developer.android.com/guide/topics/wireless/bluetooth.html
NFC
http://developer.android.com/guide/topics/nfc/index.html
You clearly said "no third party server". But may I suggest xmpp. I've had good luck with smack derived jars and OpenFire. You get a lot of flexible and easy to use functionality out of the box. It may be your best bet for chat type applications.
We host our own instance of OpenFire and authenticate against Active Directory. The XMPP protocol provides the user/device addressing, routing, and, optionally, store and forward capabilities.
It also makes it easy to exchange device data with applications written for other operating systems and in other languages. XMPP IQ packets can be used for lookup type transactions without the overhead of a Chat type connection (no presence information, back end XEP-114 plug ins to connect with server side resources).
Not really: your device has to know which device to connect to. You could theoretically do that if you know the IP of the device, but with mobile phones this changes frequently and I'm not even sure if mobile providers will let you connect directly to devices on their network. So, you're at least going to need a 'step' in between the two phones that you can trust to be stable.
What you could do is set up your own server, and let a user (user1) upload messages to your server addressed to a specific sender (user2). When the message is received, you can use C2DM to send a signal to user2's phone, and attach the message's unique identifier to this. When user2's app receives this message, you can proceed to download the message content from your webserver.
If you don't want to use any webserver at all, you're limited to the options mentioned by Calvin: WiFi, bluetooth or NFC.
Unfortunately having a direct socket connection between mobiles phones is almost impossible as they invariably are behind firewall. BTW also look at https://www.alljoyn.org/ Its an interesting technology as well.

Do I need a SIP Server / Registrar to implement a SIP intercom system?

Do I need a PBX or SIP server to allow two devices to communicate via SIP?
Lets assume one device (Android or IOS) knows the IP address of another. Couldn't that device send the INVITE directly to the other and get a conversation started, without the need for a SIP server? Or am I oversimplifying and the SIP server does something magical that I'm missing?
Thanks,
Mike
What you are describing is peer-to-peer SIP which does not require any servers in the middle. So yes it is possible.
As per SIP standard there is no restriction of SIP server to be use.
Server is use because we do not have to remember location (IP Port) of all SIP users.
When user register with server, Server take care of location of user.
(Server provide so many other features but to make this description easy ignoring all)
But in your case as you know IP address of another user no need of server.
Just make sure a SIP stack you are using is allow you to send INVITE without REGISTER. Because some stack restrict client to send INVITE without successfully register.

Categories

Resources