Zum Inhalt springen

IT_specialist

Mitglieder
  • Gesamte Inhalte

    1
  • Benutzer seit

  • Letzter Besuch

  1. Hallo zusammen, ich habe ein kleines Projekt bekommen. In diesem Projekt muss ich ein Programm schreiben mit dem ich auf einen bestimmten server bestimmte ports, die offen sind testen kann. Da ich in der Berufschule nur Java als Programmiersprache lerne, bietet es sich an das Programm in dieser Sprache zu schreiben. So eine Aufgabe ist für mich komplett neuland, weil ich nur die Grundlagen kenne Das Programm sollte nur auf einem bestimmten server zwei offene ports testen. Ich bin für jede Unterstützung dankbar! Habe auch eine Port scanner gefunden und diesen versucht so um zu bauen, dass die Ausgabe auf einer grafischen Oberfäche passiert.... Also ich glaube ich verstehe das Problem bei diesem Quelltext nicht so ganz und es funktioniert auch net so ansatzweise face-sad Wäre für eure Unterstützung sehr dankbar!! Java Quelltext: import java.io.IOException; import javax.swing.*; import java.net.*; import java.io.IOException; import java.awt.*; import java.awt.event.*; import java.util.*; public class PScanner extends Frame{ public PScanner(){ super("Unser erstes Fenster..."); this.setSize(500,300); this.show(); } public static void main(String args[]){ PScanner f=new PScanner(); InetAddress ia=null; String host=null; try { host=JOptionPane.showInputDialog("Enter the Host name to scan:\n example: xxx.com"); if(host!=null){ ia = InetAddress.getByName(host); paint(ia);} } catch (UnknownHostException e) { System.err.println(e ); } System.out.println("Bye from NFS"); System.exit(0); variables for menu bar } public static void paint(Graphics g ,final InetAddress remote){ int port1=80; int port2=80; String hostname = remote.getHostName(); try { Socket s = new Socket(remote,port1); Socket p = new Socket(remote,port2); g.drawString("Server is listening on port "+port1+ "of " + hostname, 100, 60); g.drawString("Server is listening on port " + port2+ " of " + hostname, 100, 60); s.close(); } catch (IOException ex) { The remote host is not listening on this port g.drawString("Server is not listening on port " + port1+ " of " + hostname, 100, 60); g.drawString("Server is not listening on port " + port2+ " of " + hostname, 100, 60); } }for ends } Quelltext Ende! Gruß IT_specialist

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...