Skip to content

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

Open
@qadir227

Description

@qadir227

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions