Connect failed: ENETUNREACH (Network is unreachable) while http getFile call


#1

Hey all!

I have tried to get the file from my api server using http getFile function on my NS angular application.

But below mentioned error occurred.

System.err: java.net.ConnectException: failed to connect to /(***.**.**.*** (port ****): connect failed: ENETUNREA
CH (Network is unreachable)
System.err:     at libcore.io.IoBridge.connect(IoBridge.java:114)
System.err:     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
System.err:     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
System.err:     at java.net.Socket.connect(Socket.java:843)
System.err:     at com.android.okhttp.internal.Platform.connectSocket(Platform.java:152)
System.err:     at com.android.okhttp.Connection.connect(Connection.java:101)
System.err:     at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
System.err:     at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
System.err:     at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
System.err:     at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)

System.err:     at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
System.err:     at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:543)
System.err:     at org.nativescript.widgets.Async$Http$1.run(Async.java:482)
System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
System.err:     at org.nativescript.widgets.Async$PriorityThreadFactory$1.run(Async.java:52)
System.err:     at java.lang.Thread.run(Thread.java:841)
System.err: Caused by: libcore.io.ErrnoException: connect failed: ENETUNREACH (Network is unreachable)
System.err:     at libcore.io.Posix.connect(Native Method)
System.err:     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
System.err:     at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
System.err:     at libcore.io.IoBridge.connect(IoBridge.java:112)
System.err:     ... 16 more

Can anybody tell why its occurred?

Cheers!