Autore Topic: Connection Refused  (Letto 568 volte)

Offline nio74

  • Nuovo arrivato
  • *
  • Post: 27
  • Respect: 0
    • Mostra profilo
  • Dispositivo Android:
    Samsung S5
  • Sistema operativo:
    Windows 10
Connection Refused
« il: 13 Settembre 2014, 17:09:08 CEST »
0
Ciao a tutti ho un problema con la mia applicazione che va a leggere i dati in un pc su uno script PHP,se la faccio partire da emulatore funziona,se la faccio partire  sul mio S4 mi da errore,Tenete conto che se provo il tutto sulla rete di casa funziona.Mi direte che non ho aperto la porta 80 del router invece è aperta.

Ho provato a cambiare la stringa di connessione ma niente io uso questa
Codice: [Seleziona]
HttpPost httppost = new HttpPost("http://192.168.1.14:80/httppost/prova.php");
Questo è il Logcat:

Codice: [Seleziona]
09-13 17:05:47.021: W/System.err(31967): org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.14:80 refused
09-13 17:05:47.021: W/System.err(31967):         at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
09-13 17:05:47.021: W/System.err(31967):         at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
09-13 17:05:47.021: W/System.err(31967):         at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
09-13 17:05:47.031: W/System.err(31967):         at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
09-13 17:05:47.031: W/System.err(31967):         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:670)
09-13 17:05:47.031: W/System.err(31967):         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:509)
09-13 17:05:47.031: W/System.err(31967):         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
09-13 17:05:47.031: W/System.err(31967):         at com.example.access.MainActivity$TaskAsincrono.doInBackground(MainActivity.java:63)
09-13 17:05:47.031: W/System.err(31967):         at com.example.access.MainActivity$TaskAsincrono.doInBackground(MainActivity.java:1)
09-13 17:05:47.031: W/System.err(31967):         at android.os.AsyncTask$2.call(AsyncTask.java:288)
09-13 17:05:47.031: W/System.err(31967):         at java.util.concurrent.FutureTask.run(FutureTask.java:237)
09-13 17:05:47.041: W/System.err(31967):         at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
09-13 17:05:47.041: W/System.err(31967):         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-13 17:05:47.041: W/System.err(31967):         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
09-13 17:05:47.041: W/System.err(31967):         at java.lang.Thread.run(Thread.java:841)
09-13 17:05:47.041: W/System.err(31967): Caused by: java.net.ConnectException: failed to connect to /192.168.1.14 (port 80) after 10000ms: isConnected failed: EHOSTUNREACH (No route to host)
09-13 17:05:47.041: W/System.err(31967):         at libcore.io.IoBridge.isConnected(IoBridge.java:223)
09-13 17:05:47.041: W/System.err(31967):         at libcore.io.IoBridge.connectErrno(IoBridge.java:161)
09-13 17:05:47.051: W/System.err(31967):         at libcore.io.IoBridge.connect(IoBridge.java:112)
09-13 17:05:47.051: W/System.err(31967):         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
09-13 17:05:47.051: W/System.err(31967):         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:460)
09-13 17:05:47.051: W/System.err(31967):         at java.net.Socket.connect(Socket.java:833)
09-13 17:05:47.051: W/System.err(31967):         at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
09-13 17:05:47.051: W/System.err(31967):         at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
09-13 17:05:47.051: W/System.err(31967):         ... 14 more
09-13 17:05:47.051: W/System.err(31967): Caused by: libcore.io.ErrnoException: isConnected failed: EHOSTUNREACH (No route to host)
09-13 17:05:47.051: W/System.err(31967):         at libcore.io.IoBridge.isConnected(IoBridge.java:208)
09-13 17:05:47.051: W/System.err(31967):         ... 21 more

Questo il Manifest:

Codice: [Seleziona]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.access"
    android:versionCode="1"
    android:versionName="1.0" >
   <uses-permission android:name="android.permission.INTERNET"></uses-permission>

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


Offline bradipao

  • Moderatore globale
  • Utente storico
  • *****
  • Post: 4043
  • keep it simple
  • Respect: +567
    • Github
    • Google+
    • bradipao
    • Mostra profilo
  • Dispositivo Android:
    Nexus 5
  • Play Store ID:
    Bradipao
  • Sistema operativo:
    W7
Re:Connection Refused
« Risposta #1 il: 13 Settembre 2014, 17:51:42 CEST »
0
Ma il cellulare è in rete locale in Wi-Fi, o è connesso con la rete cellulare?
NON rispondo a domande nei messaggi privati
Bradipao @ Play Store

Offline nio74

  • Nuovo arrivato
  • *
  • Post: 27
  • Respect: 0
    • Mostra profilo
  • Dispositivo Android:
    Samsung S5
  • Sistema operativo:
    Windows 10
Re:Connection Refused
« Risposta #2 il: 13 Settembre 2014, 17:59:40 CEST »
0
Mi Rispondo da solo era un problma di router non era stato attivato lo scambio di dati tra i vari dispositivi