Visualizzazione dei risultati da 1 a 3 su 3

Discussione: ftp Connection reset

  1. #1
    Utente di HTML.it L'avatar di morphy79
    Registrato dal
    Jun 2004
    Messaggi
    1,568

    ftp Connection reset

    ciao ho un server ftp fatto in java attivo 24h/24 ma ogni tanto, in modo inconcepibile, si blocca tutto..
    se cerco di stabilire delle connessioni mi viene restituito "Connection reset"
    eppure mi sembra tutto giusto.. questa la run dell'applicazione server..

    codice:
    public void run(){
    	  
        Socket socket;
        
        // IMPOSTO INDIRIZZO IP DI DEFAULT
        String indirizzoIP = "";
    
        try{
        
          // LETTURA DA FILE DI CONFIGURAZIONE DELL'INDIRIZZO IP (se vuoto utilizzo quello locale)
          indirizzoIP = Conf.getNodeValue("Server.ip");
          if (indirizzoIP.equals("")){
        	  indirizzoIP = java.net.InetAddress.getLocalHost().getHostAddress();
          }
          
          ss = new ServerSocket(Conf.getServerPort(),100, InetAddress.getByName(indirizzoIP));
          
          obsServerStarted(true);
    
          while(true){  
    
    	       try { Thread.currentThread().sleep(1000); } catch (Exception ex) {}
        	  
    	       		socket = ss.accept();
    				if (!Conf.isBanned(socket) && probes.size() < maxConnections) {
    					
    					// CONTROLLO LIMITE SESSIONE
    					if (sessionNr >= Integer.MAX_VALUE){
    						sessionNr = 0;
    					}
    					
    					// INCREMENTO IL NUMERO DI SESSIONE
    					sessionNr = sessionNr+1;
    
    					Probe p = new Probe(socket, this, sessionNr);
    			        probes.add(p);
    					obsClientConnected(p.ses.us);
    			        p.start();
    
    					
    				}else {
    					socket.close();
    				}
          }
        }catch(SocketException se) {
        	
        	bb.dockException(se,"");
        	
    			if (!suspended){
    				obsServerStarted(false); //server could not be started
    			
    				// SERVER NON AVVIATO
    				arrestaProgramma(indirizzoIP, Conf.getServerPort() );
    
    			}
    			
        }catch(IOException e){
          bb.dockException(e,"");
    
    	} catch (Exception e) {
    
    		bb.dockException(e,"");
    		
    		// SERVER NON AVVIATO
    		if(indirizzoIP.equals("")){
    			indirizzoIP = "unknown";
    		}
    		arrestaProgramma(indirizzoIP, Conf.getServerPort() );
    	}
    	
    	
    	
    		if(suspended)
    			obsServerStoped();
      }
    odio chi parla di politica..
    anzi vorrei fondare un partito contro tutto ciò

  2. #2
    Moderatore di Programmazione L'avatar di LeleFT
    Registrato dal
    Jun 2003
    Messaggi
    17,328
    Ehm... qualche cosa dai log del server? Le eccezioni che catturi, dove vanno a finire?


    Ciao.
    "Perchè spendere anche solo 5 dollari per un S.O., quando posso averne uno gratis e spendere quei 5 dollari per 5 bottiglie di birra?" [Jon "maddog" Hall]
    Fatti non foste a viver come bruti, ma per seguir virtute e canoscenza

  3. #3
    Utente di HTML.it L'avatar di morphy79
    Registrato dal
    Jun 2004
    Messaggi
    1,568
    si vanno in un log ma non ho exception...
    anche se ora ho visto che IOException non era gestita.. magari è quella..
    ho anche chiesto ad un utente della sun ma dopo sta risposta vaga è sparito..

    "Insufficient. If you got a SocketException or IOException from the accepted socket you must close it. If you got one of those while creating the ServerSocket+ it means you couldn't start the server. If you got it while accepting that is a third condition. Your try/catch structure should reflect these three possibilities. At present it doesn't. "

    per quello ho il dubbio del codice corretto...
    solo che non trovo nulla di nulla :master:
    odio chi parla di politica..
    anzi vorrei fondare un partito contro tutto ciò

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.