How to use the VPN API on Android? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I'm exploring VPN Connectivity in Android.
I want to know how to setup a VPN connection in Android using an application.
I came across some sample code named ToyVpn. I ran the application but I didn't know what data I had to give in the form displayed by that application. Considering I have a VPN server with an IP address (say 10.162.1.2), what do I need to do in that application so this app work ?
If I try to use a public VPN server, what do I need to do?
I downloaded OpenVPN source code from GIT/ics-openvpn and I compiled it and ran on my ICS device, but I didn't know how to configure the data that needs to be entered.
Please can somebody provide the exact way to use this app ?

I want to know how to setup a VPN connection in Android using an application?
The Android SDK comes bundled with a sample; see ToyVpn in the android-16 samples directory. Also consult the documentation for VpnService and VpnService.Builder.
I came across a sample code namely ToyVpn.I ran the application but i dont know what datas i need to give in the form shown by that application, Consider iam having a VPN server with ip-address (say 10.162.1.2), What i need to do in that application to make that app work .
Your VPN will need to create a new socket, protect the socket from being routed back into the VPN using VpnService.protect(Socket), and connect the socket to 10.162.1.2. Having set up a tunnel connection to the VPN server, you should proceed to writing the input stream of the VpnService's interface into the tunnel's output stream, and in turn write the tunnel response back into the interface output stream.
If i try to use any public VPN server, What i need to do?
There is no standard mechanism in place for setting up a connection to a VPN server. ToyVpn simply communicates over a socket using raw TCP packets. You can either implement an existing protocol (see RFC 4026) like OpenVPN has done or write something yourself.

Related

Useful APIs to Live Video Stream between Windows C# and Android Java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Following this approach. I want a Client to Live Stream Video to a server using IP communication. Requirements are Android Studio Java Client and Visual Studio C# Server and this is why I didn't find exact situation on StackOverFlow. I set up a basic UDP Datagram between Android Java and Windows C# and it's up and running two-way sending short messages. Where do I start with Video Streaming?
Shall I figure it out myself how to get the images frame by frame in the server, break each frame into byte[] order them and send over using UDP, then in the client's side, rebuild each frame using byte[] data received?
Is't fine to use UDP?
What are useful APIs on both C# and Java?
Is it going to be easier on the long run to set both as Java?
Do I need time to adapt Windows Java IDEs now and start from there? Is it the same as Android?
Two many questions on my head and I don't have enough knowledge. I have never done "big" nor "networking" application before. I feel lost on what to do. Finding APIs would really be helpful. Thanks in advance
Don't invent your own protocols, use existing ones like RTP, RTSP (or even a HTTP server).
For instance RTSP (Real-Time Streaming Protocol):
With this project (https://net7mma.codeplex.com/), you're able to set up RTSP server which serves a media file in exactly 5 lines of Code in C#.
using(Rtsp.RtspServer server = new Rtsp.RtspServer(555)){
Media.Rtsp.Server.Media.RtspSource source =
new Media.Rtsp.Server.Media.RtspSource("RtspSourceTest", "rtsp://1.2.3.4/mpeg4/media.amp");
//If the stream had a username and password
//source.Client.Credential = new System.Net.NetworkCredential("user", "password");
//Add the stream to the server
server.AddMedia(source);
//Start the server and underlying streams
server.Start();
}
And according to the project page:
The RtspServer does successfully aggregate live Rtsp video streams in ANY container or codec to a compatible RtspClient or Player (VLC, Mplayer Darwin Streaming Server and QuickTime have been tested)
This lets you turn your Web Camera or Digital Camera or source of images into a LIVE Rtsp Stream!
With this server side written in C# as a general RTSP server, you can use existing objects like a normal VideoView (https://stackoverflow.com/a/10461150/5296568) on the Java/Android side to connect and view that live stream without problems.

Android App with Online Database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i'm creating an app wherein the database are uploaded online without website, the concept of the app is like Waze app. I dont know where to start im asking for ideas and help. do i need to create a web server?how?i will mark this correct for those who can answer thanks.
This is not a simple task because it relies on many parts doing its proper job... In order to do what you want to do you need basically 5 things:
1.- Server: which will feed live information to the app.(There is a ton of servers that can be used to get this part done. If you are used to, or willing to learn php, I suggest you to start researching XAMPP (it uses Apache server running php stuff) [https://www.apachefriends.org/es/index.html]).
2.- Database: Most likely the server will need to work with information stored in some place. databases are perfect for just that. XAMPP also comes with MySQL which happens to be the most popular open source database out there.
3.- Format :You need to determine how the information will be passed from the server to the mobile device. The most common ways are: JSON which is plain text, XML that also is plain text but formatted diferently. this is important because you have to send the information from the server using this format and also your mobile devices will need to interpret the information in this format.
4.- Choose a way to send and recive the information : i would suggest Http/Ip protocol for this, as it is very common. Investigate Http requests and responses.
5.- Your device must be listening (or asking) for the content : the device will have to implement some sort of timer to ask the server for new information. This is determined by the logic and prupose of what you wish to do.
do i need to create a web server?
Yes! You need to create a web server, then, a webservice (database query etc...) which communicate between your application and your webserver. I think that all!

Is there any library to manage TCP packets on Android? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am trying to make connection between my Python3 local LAN server script and my Android device. While testing i am using Android Virtual Device Manager. Main target is to keep connection between server and clients for a long time (1 hour).
Is there any good library to send and receive packets for an Android and to make things easier? Phone must work as a client which can send and receive data from server.
P.S. Im targeting API 15.
I only managed to send packets to Python and print them in console. I was using PrintWriter class to send data and java.net.Socket class to open a socket. Tried to read incoming data but there was a lot of errors.
Volley is a very good library for making asynchronous HTTP requests on Android.
Kryonet is another very good Java network library for sending TCP and UDP packets over network efficiently which runs on Android as well. Though whenever I used Kryonet, I wrote both the server side code and client side code using this library. Kryonet keeps the connection alive though, so if you don't have any issues changing your server side code from Python to Java (Kryonet has samples which you can use), then it will serve your purpose well.
Using this library, you don't even need to hardcode any IP address. You can discover the local server in real time with just one line of code.

How to make only one instance of application to be used by multiple users? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is not about restricting opening multiple instances. I wrote a little app that creates reports and send scheduled emails. This app is on a common drive folder that everybody in our company has access to.
I want to set it up the way so that it would really execute only from my computer (like a server). However, all other people could open it and see all the processes that are going on at the instance that is open on my computer and could also make modifications etc
How can I do it?
A single copy of an app running on a server and handling requests from multiple locations... that's called "client-server" and you have essentially two choices:
A modern HTML-based web application (aka "thin client", but the "thin" part is debatable nowadays). The user interface is implemented in HTML/Javascript/CSS, runs on the client's browser, and interacts with a web server over the network (HTTP or AJAX or both) to execute the application logic. The main advantage of this is that the client needs only a modern web browser and can be run on any platform that supports the browser (Windows, Linux, iOS, MacOS, etc)
A "fat client" application. You write the user interface using Java/Swing/AWT/GWT/etc, and a server component also using Java. They communicate over the network using whatever you want to layer on top of TCP/IP. This can also run on many clients but they must have Java installed, so iOS is probably out. And clients may need to install Java, and some users may not want to. I.e. some clients might encounter a barrier to running your app.
A detailed explanation of how to write client-server apps is far beyond the scope of SO. You'll need to do a lot of reading and studying.

How to create an adhoc network between laptops in java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to create an adhoc between labtops were they will communicate using wireless communication. I will use java for this but still I do not know how to start..
I think I'll have to use sockets for the connections right? How will a laptop notice other laptops in its local network or the other way around? Do i need a server to handle the communication between laptops? Another thing, how to broadcast a message from one laptop to other laptops in the network? Please reply as soon as you can. Any help will be appreciated. Thanks in advance.
Generally changing network settings is both a privileged and system-specific task, so it's not ordinarily something that java applications should or would be permitted to do.
That's not to say it's necessarily impossible. For example, if you can figure out how to create and/or join a network from the command line, you may be able to issue those commands if the JVM permits it and you can somehow secure the necessary permissions. On a linux machine, this would probably be some combination of iwconfig and/or ifconfig usage - but normally requires root.
One you have a network up then you can deal with socket type traffic over it - an area where java is far more at home, and one that is often possible without special privileges, at least as far as the operating system is concerned.
Can you restate the problem:
Do you want to create appropriate low level settings for the "hardware" to set up ad-hoc WLAN
This is what the answers above try to handle...
You have two devices already authenticated in a WLAN that should be able to mutually detect services (in the way UPnP is designed)?
In this case you have some other tools available. You start with advertising a service using somthing like Zeroconf (Bonjour, available as jmDNS in open source). The other party is able to look up the service using jmDNS again. This works using UDP.
Once found you can establish direct IP communication as usual.
To broadcast information you have to program sockets on UDP level. If you don't want to go to greatest detail, there are also frameworks around (Apache MINA).
If u have to use java, I would advice u to have a look at the JANE, Java Ad Hoc Network Development Environment.
Good luck.
Is this academic? If so, try using simulators first. There are a lot of good simulators available for free (For eg. NS2, glomosim). It is a good place to start for proof of concept. These simulators have good mobile communication protocols (including mobile adhoc setup). You will not have to deal with nitty-gritty details and concentrate more on your application.

Categories

Resources