DWorkS / VolleyPlus

🏐 Volley library : make everything faster . Its an improvements for Volley by Google for Android https://android.googlesource.com/platform/frameworks/volley
https://github.com/DWorkS/VolleyPlus
984 stars 274 forks source link

java.net.SocketException: sendto failed: EPIPE (Broken pipe) #62

Open qadir227 opened 7 years ago

qadir227 commented 7 years ago

I am trying to upload file to my server using SimpleMultipartRequest. I am getting this issue java.net.SocketException: sendto failed: EPIPE (Broken pipe)

Here is my code.

public void makeMultipartRequest(final String imagePath, final String requestTag, final String url, int method, final ProgressBar mProgressBar) {

        Log.e("imagePath", imagePath);
        mProgressBar.setVisibility(View.VISIBLE);
        SimpleMultiPartRequest smr = new SimpleMultiPartRequest(method, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        Log.e("response: ", response + "onResponse");
                        try {
                            JSONObject jObj = new JSONObject(response);
                            mVolleyResponse.onVolleyResponse(url, jObj);
                            mProgressBar.setVisibility(View.GONE);

                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e("Error: ", error.getMessage() + "Error");
                mVolleyResponse.onVolleyError(url, error);
                mProgressBar.setVisibility(View.GONE);
            }
        });

        smr.addFile("file", imagePath);

        smr.setRetryPolicy(new DefaultRetryPolicy(0,
                DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
                DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        BaseApplication.getInstance().addToRequestQueue(smr);
    }

Here is how I am calling this method. makeMultipartRequest(image_path, fileUploadUrl[0], fileUploadUrl[1], Request.Method.POST, img_upload_loader);

My webservice is working fine in POSTMAN, Here is screen shot. http://prntscr.com/fiyx4s

nono7199 commented 5 years ago

can u solve?