yourkishore
yourkishore

Reputation: 278

Making more http requests in nanoHTTPD leads to closing server

I have a nanoHTTPD server running on my app in background, when i have like more than 30 http get requests to the server, from then server getting stopped, image loading fails.

is there a limit for number of http request in server, or is the android cannot handle those many request at once ? any help is appreciated.

Upvotes: 0

Views: 645

Answers (1)

Paul Hawke
Paul Hawke

Reputation: 1141

How is your Android application structured? Is the server started by an activity as part of its normal lifecycle? If so, Android might simply be stopping & garbage collecting your activity once it's in the background.

To avoid that happening you will want to start an Android service and start/stop your NanoHttpd server in the service rather than the application.

There are no limits on the number of pages, or bytes, that the NanoHttpd server can serve. I'd point the finger at the Android lifecycle (without knowing any more that is).

Upvotes: 2

Related Questions