java.net.SocketException: sendto failed: ECONNRESET (Connection reset by peer)

前端 未结 1 1968
我在风中等你
我在风中等你 2020-12-19 18:42

I try to use this code to connect to server for uploading an image.

    try {
        url = new URL(requestURL);

        HttpURLConnection conn = (HttpURLCo         


        
相关标签:
1条回答
  • 2020-12-19 19:20

    Hi am also facing the same problme.Now resolved using below code.I hope it will also help you.. try it....

    Put this below code within onCreate()

     @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_upload_documents);
    
        if (android.os.Build.VERSION.SDK_INT > 9) {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
                    .permitAll().build();
            StrictMode.setThreadPolicy(policy);
        }
    
       //Statement or Controls Declaration or your code
    
    }
    
    0 讨论(0)
提交回复
热议问题