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

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.

Related

How to create reactive UI using Angular 2 and Java Rest services [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 2 years ago.
Improve this question
I am trying to understand how to create reactive UIs using angular 2 and java rest service.
What I am trying to achieve -
Consider a simple single page to-do application.
Multiple users open this same UI, and every one's UI is updated as soon as any one of user add/updates/deletes a to do list item, without having to do any manual refresh or other action.
I searched how one would go about implementing this and mostly found results around RxJS and RxJava. I understood the concept of observables. But what I don't understand is how would the UI subscribe to server data changes. If what I am trying to achieve is not achievable with above mentioned technologies, I am open for any other options, but my server has to be Java based.
If you could provide a working example / exact libraries / links that would be of great help.
Thanks
If you want to communicate from a java backend server in a realtime manner with your frontend applications, you can do this through sockets. A popular library to do this is using 'socket.io': http://socket.io/.
At startup/login time in your frontend you could open a socket to connect to the backend. Every time a change is made by a specific user, you could send a message over this socket from the java backend to your frontend.
If you are working with redux, you could even send a redux action from your backend to the frontend over the socket. In your socket listener in the frontend you could just dispatch that action to the store so your state is updated.
After a quick internet search I found this article which describes using socket.io (there's a java connector for socket io as well) and redux: http://spraso.com/real-time-data-flow-with-redux-and-socket-io/

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.

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

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.

EMail Client Library [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'm looking for a library that wraps the javamail API on the receiving side, in the same manner that Commons Email handles the sending of emails.
In my perfect world the library works in the following manner:
Subscribe to a mail server
Notify me when an email arrives
Handle attachments for me (why should I care about base64 encoding?)
Disconnect from the mail server
Anybody know of a mail library/API that does the above?
You may look at Jodd Email: https://jodd.org/email/ (see: 'Receiving emails'). Besides for sending emails, it also wraps javamail API for receiving emails. So you can do:
Connect to a pop3 (plan and ssl) mail server
Receive emails manually
Process all received emails using simple API; including multiple messages, attachments, contentIds etc.
Disconnect from mail server
As you see, you have to receive emails manually, so it will not notify your code out-of-box (your point #2). This is done on purpose, as there are many ways how your code can be notified and how received email can be monitored. Most of this is really easy to implement or depends on the rest of your application architecture/used libraries.

Using mail servers in Java [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 4 years ago.
Improve this question
I want to use a mail server where the users send emails to it and then I parse this emails then do some action.
Please suggest me what mail server to be used and where to start.
You can also use JavaMail API to read a POP3/IMAP mailbox on your regular mail server. This makes it easier to use a mailbox in your regular domain. Camel packages these API's at a high level and makes it really easy to integrate with mailboxes, transform the message inside and send the results wherever they are needed.
Now if it are easy things you need to do then you can configure most mailservers to deliver mails to a script. This is REALLY easy but Java is not really suitable to write this script in because the startup cost of the JVM is too high. A simple batch script or perl/ruby/vbscript thingy could be all you need.
Are you saying you want to use Java to send a mail message to a mailbox configured on your mail server or to read from the mailbox and to process the message? So you just want to know of a mail server you can install on your local pc to test with? If that's the case and you are running on a Windows OS you can install hMailServer. If you are using Linux / Unix you can configure Postfix.
Apache James is a mail server written in Java that you could use.

Categories

Resources