简体   繁体   中英

Failed to connect to /192.168.0.101 (port 443) from /192.168.0.102 (port 47108) after 10000ms

I was working on a project it was working fine but now it is not working every time it is giving me the error that it fails to get connected.

This is my java class

public class APIClient {
    static Retrofit retrofit = null;

    public static String Base_URL = "http://192.168.0.101:80/";
    public static final String APPEND_URL = "/martzila/api/";
    public static UserService getInterface() {
        HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
        interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
        OkHttpClient client = new OkHttpClient.Builder()
                .addInterceptor(interceptor)
                .build();
        retrofit = new Retrofit.Builder()
                .baseUrl(Base_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .client(client)
                .build();
        return retrofit.create(UserService.class);
    }
}

I am trying to run on my physical device, my laptop and physical device are on the same wifi network but it still gives me the error

E/Error: failed to connect to /192.168.0.101 (port 80) from /192.168.0.102 (port 32790) after 10000ms

Please help me I don't know what to do now

public class APIClient { static Retrofit retrofit = null;

public static String Base_URL = "http://192.168.0.101:80/";
public static final String APPEND_URL = "/martzila/api/";
public static UserService getInterface() {
    HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
    OkHttpClient client = new OkHttpClient.Builder()
            .addInterceptor(interceptor)
            .build();
    retrofit = new Retrofit.Builder()
            .baseUrl(Base_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .client(client)
            .build();
    return retrofit.create(UserService.class);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM