import java.io.* ;
import java.net.* ;

public class SkanerUDP
{
    public static void main (String[] arg)
    {
        String host = "localhost" ;
		if (arg.length>0)
        {
            System.err.println("Programu nie mozna wywolac z zadnymi parametrami.") ;
            return ;
        }
        try
        {
            InetAddress adres = InetAddress.getByName(host) ;
            System.out.println("Analiza lokalnych portow UDP:") ;
            for (int p=1 ; p<65536 ; p++)
                try
                {
                    DatagramSocket serwer = new DatagramSocket(p) ;
					System.err.print(p+" ") ;
                    serwer.close() ;
                }
                catch (IOException ex) { System.out.println("- usluga na porcie udp"+p+" - ") ; }
			System.err.println() ;
        }
        catch (UnknownHostException ex) { System.err.println("Nieznany host ("+host+").") ; }
    }
}
