PDA

Visualizza la versione completa : Errore java.net.SocketException: Connection reset


 
lollo84
29-05-2009, 11:16
Ho creato una piccola Applet che in grado di connettersi via ftp (la connessione ftp perfettamente funzionante) al mio server ed eseguire alcune operazioni di controllo dei dati presenti sul server, fino a qu tutto funziona perfettamente senza intoppi. Il problema nasce quando dal server devo leggere il contenuto di un file txt, a questo punto mi va in eccezzione e dice:



java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.TransferProtocolClient.readServerResponse( Unknown Source)
at sun.net.ftp.FtpClient.readReply(Unknown Source)
at sun.net.ftp.FtpClient.issueCommand(Unknown Source)
at sun.net.ftp.FtpClient.openDataConnection(Unknown Source)
at sun.net.ftp.FtpClient.get(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.getInput Stream(Unknown Source)
at ModificaGestione.modificaIndirizzo(ModificaGestion e.java:37)
at FrameSceltaInserimento.actionPerformed(FrameScelta Inserimento.java:54)
at javax.swing.JComboBox.fireActionEvent(Unknown Source)
at javax.swing.JComboBox.setSelectedItem(Unknown Source)
at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$Handler.mou seReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$1.processMo useEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Mi pare di avere capito che un problema dovuto alla terminazione della connessione con il server, ma a questo punto non s davvero come risolvere il problema, voi come fareste per risolvere il problema?

La parte di codice che mi da errore :

String indirizzo3="ftp://nomeutente:password@indirizzo"+"/"+Cartella+"/"+cartDest+"/connesso.txt";
URL url3 = new URL(indirizzo3);
URLConnection urlc3 = url3.openConnection();

BufferedReader lettConn = new BufferedReader( new InputStreamReader(urlc3.getInputStream())); // L'errore lo d qu
int contaCont=0;
String lineConn;
ArrayList<String> contenutoConn=new ArrayList<String>();
System.out.println("Lettura stringa file testo "+lettConn.readLine());
while (lineConn=lettConn.readLine()!=null) {
contenutoConn.add(lineConn);
contaCont++;
}
lettConn.close();

Grazie anticipatamente per le eventuali risposte.

Loading