I am trying to remove some media from my mobile application using the retrofit2 REST client.
@HTTP(method = "DELETE",path="/api/v1/media/{username}/{accesstoken}", hasBody = true) Call<MyResponse> deleteArchiveMedia(@Path("username") String username, @Path("accesstoken") String token , @Body DeleteMedia deleteMedia);
This is a call to delete.
DeleteMedia is a class that contains 2 lists of arrays, one for channelId and another for Mediaid
Delete works when deleting several media data (less than 100), but when deleting more than 100 media data, it returns an error, for example:
recvfrom failed: ECONNRESET (Connection reset by peer)
Why does this only happen when I try to delete a large number of media files?
Is there any limit for retroffit2 body retroffit2 ?
Please help me......
retooling class
public class DeleteModule { private static Retrofit retrofit = null; public static Retrofit getClient() { System.setProperty("http.keepAlive", "false"); final OkHttpClient okHttpClient = new OkHttpClient.Builder() .readTimeout(60, TimeUnit.SECONDS) .connectTimeout(60, TimeUnit.SECONDS) .writeTimeout(60,TimeUnit.SECONDS) .build(); if (retrofit == null) { retrofit = new Retrofit.Builder() .baseUrl(Constants.getBaseURL()) .addConverterFactory(GsonConverterFactory.create()).client(okHttpClient) .build(); } return retrofit; } }
source share