Category Archives: android

Jetty server taking alot of time to send the response back

I've written a jetty 9 server that I'm using for performance analysis & benchmarking. Profiling the server is part of the equation to ensure there is nothing unnecessary consuming time on the server.

Mechanism:

A client sends a payload of 20KB to the jetty server. The HttpServlet notifies me about the request using doPost(). I'm using the request.getInputStream() to read all the data.

According to the HttpServlet documentation:

Called by the server (via the service method) to allow a servlet to handle a POST request. The HTTP POST method allows the client to send data of unlimited length to the Web server a single time

My current understanding is, this inputStream reads data from a local inputStream where the network stack has buffered all the data coming from the client in a request. Sometimes reading data from this inputStream takes merely a few miliseconds but other times it can take over 10 seconds. Now I'm skeptical that the inputStream is probably reading the data from the network stream rather then a local buffered stream which means the HTTP servlet is acting like TCP sockets in which the data is streamed to the destination.

protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Long startTime = Calendar.getInstance().getTimeInMillis();
        String clientRequestPayload = IOUtils.toString(request.getInputStream(), "UTF-8");
       Long endTime = Calendar.getInstance().getTimeInMillis();

      //send the response back
}

So my question is:

Does the inputStream provided by HTTPServlet read data from a network input stream or a local disk input stream?

Jetty server taking alot of time to send the response back

I've written a jetty 9 server that I'm using for performance analysis & benchmarking. Profiling the server is part of the equation to ensure there is nothing unnecessary consuming time on the server.

Mechanism:

A client sends a payload of 20KB to the jetty server. The HttpServlet notifies me about the request using doPost(). I'm using the request.getInputStream() to read all the data.

According to the HttpServlet documentation:

Called by the server (via the service method) to allow a servlet to handle a POST request. The HTTP POST method allows the client to send data of unlimited length to the Web server a single time

My current understanding is, this inputStream reads data from a local inputStream where the network stack has buffered all the data coming from the client in a request. Sometimes reading data from this inputStream takes merely a few miliseconds but other times it can take over 10 seconds. Now I'm skeptical that the inputStream is probably reading the data from the network stream rather then a local buffered stream which means the HTTP servlet is acting like TCP sockets in which the data is streamed to the destination.

protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Long startTime = Calendar.getInstance().getTimeInMillis();
        String clientRequestPayload = IOUtils.toString(request.getInputStream(), "UTF-8");
       Long endTime = Calendar.getInstance().getTimeInMillis();

      //send the response back
}

So my question is:

Does the inputStream provided by HTTPServlet read data from a network input stream or a local disk input stream?

Smack connection close during file upload via retrofit

I'm developing an XMPP client on Android using Smack library and Ejabberd as my XMPP server.

so far everything is working good, but whenever Users start uploading large files and sending lots of messages rapidly, their connection got close from server. I get following from debuger:

connection Closed Error Parser got END_DOCUMENT event

uploading is handled via retrofit library

I checked Ejabberd config, so user are allowed to send messages rapidly and config of php upload server allows large files uploading.

also Ejabberd and php upload server are not in the same host.

I just can't get where the problem is, is it from smack, ejabberd or even android itself.

File transfer mechnism for large no of chunks of a huge file

I currently have a huge around 500MiB's of file to be transferred. The files are splited into small chunks of files usually of 1MB each. While i download those files the router usually gets hung up due to higher requests if two or more devices are connected simultaneously. I would want a way around to resolve this. Is there any algorithm that can be implemented to resolve this.

I also wonder if websockets could solve this issue.

Can we get around on this to download large nos of files?
The files are to be downloaded to an android devices from a embeded device running Linux (ubuntu 16.04). I am using apache as the webserver.

Android app is not getting properly downloaded

I have given a link to download my android app on my website. When I attempt to download it from the browser on my mobile, I do not get downloaded well and gives parsing error in an attempt to install it.

The android app on my server is 13 MB in size, whereas the Android app that downloads have size 1.75 KB!

I have set up my project even on another server which is accessed via HTTPS. When I download the android app from this SSL certified server, the app gets downloaded well and is installed with no parsing error.

Note: APACHE, PHP settings of both the services are same.

receive information without using intent

i haven't website! the user will select a product and will type phone number and location, so i want to receive these information and i think the only way is to use email to receive these information, i trying by using intent but its not good switching to another app. so i want another way to accomplish that i trying with that but it doesn't work Sending Email in Android using JavaMail API without using the default/built-in app

is there an way to accomplish that?

receive information without using intent

i haven't website! the user will select a product and will type phone number and location, so i want to receive these information and i think the only way is to use email to receive these information, i trying by using intent but its not good switching to another app. so i want another way to accomplish that i trying with that but it doesn't work Sending Email in Android using JavaMail API without using the default/built-in app

is there an way to accomplish that?